fossil

          鳥在籠中,恨關羽不能張飛 人處世上,要八戒更須悟空
          posts - 40, comments - 0, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          近日看到各大中文網站紛紛嗆聲說 Spring 2.5 發布, 典型消息如下:

           

          來自 Springframework 官方的消息,Spring 2.5 正式發布了。

          http://www.springframework.org/node/561

          該版本的主要特征包括:
          對Spring2.0的平滑升級 —— Spring2.5被設計成為對Spring2.0的平滑升級,現存的代碼和配置文件不需要做任何更改。
          更多XML命名空間配置 —— 新的命名空間包括和
          完全支持Java 6和Java EE 5 —— Spring2.5支持Java 6和Java EE 5的所有新特性——同時也提供了對Java 1.4.2和J2EE1.3的支持。
          完全支持基于注解的配置 —— 現在所有的配置都可以使用注解來實現,并且也支持 JSR250 注解。
          基于注解的MVC controller —— Web Controller現在可以用如@RequestMapping這樣的注解來創建,無需實現任何接口。
          對AspectJ的支持 —— 在一些環境下,增加了對AspectJ的裝載時編織支持,同時提供了一個新的bean切入點。
          對OSGi的支持 —— Spring2.5框架的所有jar包都是兼容于OSGi的,以此來簡化在OSGi環境下對其的使用。
          測試框架的巨大改變 —— 現在新的基于注解的測試框架已經支持TestNG和JUnit4
          性能的改良 —— Spring2.5各方面的性能指標都有了顯著的改善。

          沖著 完全支持基于注解的配置 這句話, 我興沖沖的下載了 Spring 2.5 以及其文檔, 企圖體驗一下 EJB 3 式的簡單快速的基于標注的開發, 然而, 遺憾的是官方文檔和消息的來源頁面: http://www.springframework.org/node/561, 沒有任何文字說到自己完全支持基于注解的配置. 我打開英文的 Reference, 仔細閱讀其中關于標注的部分, 然而遺憾的發現只是部分實現了標注, 請參考 http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-annotation-config , 簡單說就是實現了對 Autowired 和 Transaction, AOP 的標注支持, 而不是所有 bean 定義, 更不是說從此你可以不用寫 Bean 配置的 XML 文件了. 下午仔細試了半天, 企圖寫出標注配置的例子來, 也沒有成功實現不寫 bean 定義 XML 文件就能初始化 Bean 并注入所有屬性的功能(本來想做的例子是注入一個 message 的 String 屬性), 去閱讀下載的示例代碼(example目錄下的文件), 也沒有這樣的例子. 最后又發現了原來支持標注的版本在這里:

          http://www.jroller.com/habuma/entry/guice_vs_spring_javaconfig_a

          它的名字叫 Spring JavaConfig.

          最后我們再來看看原始頁面是如何介紹自己的標注的(http://www.springframework.org/node/561):

          Spring 2.5 enhances Spring 2.0 with many exciting new features, including:
          Full Java 6 and Java EE 5 support (JDBC 4.0, JTA 1.1, JavaMail 1.4, JAX-WS 2.0)
          Full-featured annotation-driven dependency injection, including support for 'qualifiers' (注意這里只是說完整支持標注驅動的依賴注入, 而不是 complete supported annotation of all features)
          Support for auto-detecting application components in the classpath and auto-configuring them as Spring managed objects
          A new bean name pointcut element in AspectJ pointcut expressions
          Built-in support for AspectJ load-time weaving based on the LoadTimeWeaver abstraction
          New XML configuration namespaces "context" and "jms", for maximum convenience
          A completely revised integration test framework, with first-class support for JUnit 4 and TestNG
          A new annotation-based controller model for Spring MVC supporting Servlet and Portlet environments
          Extended SimpleJdbcTemplate functionality, including support for named SQL parameters
          Officially certified WebSphere support
          The packaging of Spring Framework jars as OSGi-compliant bundles out of the box
          The ability to deploy a Spring ApplicationContext as a JCA RAR file, for headless application modules
          JCA 1.5 message endpoint management, for Spring-managed JMS and CCI message listeners

          小小的興奮了一把, 最后又不得不歸于失望, 繼續研究 XML 文件的編寫格式吧. 希望下次看到類似消息的時候能翻譯的準確一些, 免得誤導偶等開源軟件"消費者".

           

          當然了, 也歡迎 Spring 2.5 高人們向偶分享完全使用標注的例子代碼, 那樣的話我真是太感謝了!



          BeanSoft 2007-11-23 18:14 發表評論

          文章來源:http://www.aygfsteel.com/beansoft/archive/2007/11/23/162700.html

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 三门峡市| 东乌珠穆沁旗| 松桃| 神木县| 白城市| 固阳县| 开阳县| 安丘市| 巍山| 徐水县| 蒙山县| 读书| 封丘县| 德钦县| 双鸭山市| 宣恩县| 武穴市| 扶绥县| 贵港市| 安阳市| 张家港市| 邹平县| 平陆县| 晋州市| 安龙县| 岳阳市| 扬中市| 玛多县| 泸州市| 海盐县| 乐业县| 广灵县| 巴中市| 肃宁县| 勐海县| 鹿泉市| 沈阳市| 阳山县| 靖边县| 共和县| 迁安市|