2.2.2. Easier XML configuration

Spring XML configuration is now even easier, thanks to the advent of the new XML configuration syntax based on XML Schema. If you want to take advantage of the new tags that Spring provides (and the Spring team certainly suggest that you do because they make configuration less verbose and easier to read), then do read the section entitled Appendix A, XML Schema-based configuration.

On a related note, there is a new, updated DTD for Spring 2.0 that you may wish to reference if you cannot take advantage of the XML Schema-based configuration. The DOCTYPE declaration is included below for your convenience, but the interested reader should definitely read the 'spring-beans-2.0.dtd' DTD included in the 'dist/resources' directory of the Spring 2.5 distribution.

スプリングのXML文法?は、もっと手間が省けるようになった。XMLスキーマを基礎にした新しいXML文法の登場に感謝する。スプリングが提供する新しいTagを活用したいならば、(スプリングチームは、あなたが活用するときっと提案する。なぜなら、冗長を排除するし、読みやすくなるから。)「Appendix A, XML Schema-based configuration.」と名づけられたセクションを読んでください。

関連したメモ、もしXMLスキーマベースを活用できないのなら、スプリング2.0のためにアップデートされたDTDを参照できます。そのドキュメントタイプ宣言は、いかに便宜のために含まれているが、興味のある読者は、Spring-beans-2.0.dtdを読むべきだ。

2.2.3. Extensible XML authoring

Not only is XML configuration easier to write, it is now also extensible.

What 'extensible' means in this context is that you, as an application developer, or (more likely) as a third party framework or product vendor, can write custom tags that other developers can then plug into their own Spring configuration files. This allows you to have your own domain specific language (the term is used loosely here) of sorts be reflected in the specific configuration of your own components.

Implementing custom Spring tags may not be of interest to every single application developer or enterprise architect using Spring in their own projects. We expect third-party vendors to be highly interested in developing custom configuration tags for use in Spring configuration files.

The extensible configuration mechanism is documented in Appendix B, Extensible XML authoring.

XMLの簡単の簡単記述だけでなく。拡張性もです。

拡張性の意味は、アプリケーションベンダまたは、サードパーティーフレームワークまたは、ベンダはスプリング設定ファイルにカスタムタグを書くことが出来ます。それはあなた独自の言語を許します。

カスタムタグを実装することは、ほとんどのアプリベンダ、やアーキテクトにとって彼らのプロジェクトで使用することは、興味深くないかもしれない。私たちはサードパーティベンダがスプリング設定ファウルのカスタムタグ開発に関心があると予測しています。

拡張性のメカニズムは「Appendix B, Extensible XML 」に示されています。

2.2.4. Annotation-driven configuration

Spring 2.0 introduced support for various annotations for configuration purposes, such as @Transactional, @Required and @PersistenceContext /@PersistenceUnit.

Spring 2.5 introduces support for a complete set of configuration annotations: @Autowired in combination with support for the JSR-250 annotations @Resource, @PostConstruct and @PreDestroy .

Annotation-driven bean configuration is discussed in Section 3.11, “Annotation-based configuration”. Check out annotation support for Spring MVC as well: Section 2.5.3, “Annotation-based controllers”

スプリング2.0は@Transactional, @Required @PersistenceContext /@PersistenceUnitnなどの、構成目的の為の様々な注釈のサポートを導入しました。

スプリング2.5は設定注釈の完璧なサポートを導入した。@Autowired @Resource, @PostConstruct @PreDestroy .


セクション3.11 「注釈ベース設定」について、注釈駆動ビーン設定について議論します。スプリングMVCの注釈サポートはセクション2.5.3「Annotation-based controllers」をチェックしてください。

2.2.5. Autodetecting components in the classpath

Spring 2.5 introduces support component scanning: autodetecting annotated components in the classpath. Typically, such component classes will be annotated with stereotypes such as @Component, @Repository, @Service, @Controller. Depending on the application context configuration, such component classes will be autodetected and turned into Spring bean definitions, not requiring explicit configuration for each such bean.

Annotation-driven bean configuration is discussed in Section 3.12.1, “@Component and further stereotype annotations”.

スプリング2.5はコンポーネントスキャンニングを提供します。utodetectingはclasspathコンポーネントを注釈しました。通常そのようなコンポーネントクラスは@Component, @Repository, @Service, @Controllerとして定型注釈される。アプリケーションコンテキスト設定によって、そのようなコンポーネントクラスは、スプリングビーン設定にautodetectedそしてturnedされる。明確な設定を要求されずに。

注釈駆動ビーン設定はセクション3.12.1にある。「@Component and further stereotype annotations」

2.3. Aspect Oriented Programming (AOP)

Spring 2.0 has a much improved AOP offering. The Spring AOP framework itself is markedly easier to configure in XML, and significantly less verbose as a result; and Spring 2.0 integrates with the AspectJ pointcut language and @AspectJ aspect declaration style. The chapter entitled Chapter 6, Aspect Oriented Programming with Spring is dedicated to describing this new support.
2.3.1. Easier AOP XML configuration

Spring 2.0 introduces new schema support for defining aspects backed by regular Java objects. This support takes advantage of the AspectJ pointcut language and offers fully typed advice (i.e. no more casting and Object[] argument manipulation). Details of this support can be found in the section entitled Section 6.3, “Schema-based AOP support”.
2.3.2. Support for @AspectJ aspects

Spring 2.0 also supports aspects defined using the @AspectJ annotations. These aspects can be shared between AspectJ and Spring AOP, and require (honestly!) only some simple configuration. Said support for @AspectJ aspects is discussed in Section 6.2, “@AspectJ support”.
2.3.3. Support for bean name pointcut element

Spring 2.5 introduces support for the bean(...) pointcut element, matching specific named beans according to Spring-defined bean names. See Section 6.2.3.1, “Supported Pointcut Designators” for details.
2.3.4. Support for AspectJ load-time weaving

Spring 2.5 introduces explicit support AspectJ load-time weaving, as alternative to the proxy-based AOP framework. The new context:load-time-weaver configuration element automatically activates AspectJ aspects as defined in AspectJ's META-INF/aop.xml descriptor, applying them to the current application context through registering a transformer with the underlying ClassLoader. Note that this only works in environments with class transformation support. Check out Section 6.8.4, “Load-time weaving with AspectJ in the Spring Framework” for the capabilities and limitations.

スプリング2.0はもっと改良されたAOP提供を持っている。スプリングAOPフレームワークそれ自身はXMLのなかで際立って簡単な構成だ。そして結果として冗長を際立って少なくする。スプリング2.0は「AspectJ pointcut language」と「@AspectJ aspect declaration style」を統合する。

スプリング2.0は新しいスキーマサポートを導入する。レギュラーJavaオブジェクトによって定義された。このサポートが「AspectJ pointcut language」と完全なアドバイスを利用する?。詳しくはSection 6.3

スプリング2.0は@AspectJ注釈を使用し、アスペクト定義をサポートします。そのアスペクトAspectJとSpringAOPの間で共有され、なんらかの簡単な設定を要求します。詳しくはSection 6.2, “@AspectJ support”.

Spring2.5は「bean(...) pointcut element,」のサポートを導入します。Springnの定義ビーン名にしたがって適合させる。?

スプリング2.5はAspectJ load-time weavingを明白にサポートします。プロキシベースのAOPフレームワークの代替手段として。 新たなコンテキストload-time-weaverの設定要素自動有効化はAspectJのMETA-INF/aop.xmlで設定する。根本的なクラスローダーをそなえたtransformerの登録によって、カレントアプリに登録されること。これがクラス変換サポート環境でのみ動作することに中止してください詳しくはSection6.8.4

2.4. The Middle Tier
2.4.1. Easier configuration of declarative transactions in XML

The way that transactions are configured in Spring 2.0 has been changed significantly. The previous 1.2.x style of configuration continues to be valid (and supported), but the new style is markedly less verbose and is the recommended style. Spring 2.0 also ships with an AspectJ aspects library that you can use to make pretty much any object transactional - even objects not created by the Spring IoC container.

Spring 2.5 supports convenient annotation-driven transaction management in combination with load-time weaving, through the use of context:load-time-weaver in combination with tx:annotation-driven mode="aspectj".

The chapter entitled Chapter 9, Transaction management contains all of the details.
2.4.2. Full WebSphere transaction management support

Spring 2.5 explicitly supports IBM's WebSphere Application Server, in particular with respect to WebSphere's transaction manager. Transaction suspension is now fully supported through the use of WebSphere's new UOWManager API, which is available on WAS 6.0.2.19+ and 6.0.1.9+.

So if you run a Spring-based application on the WebSphere Application Server, we highly recommend to use Spring 2.5's WebSphereUowTransactionManager as your PlatformTransactionManager of choice. This is also IBM's official recommendation.

For automatic detection of the underlying JTA-based transaction platform, consider the use of Spring 2.5's new tx:jta-transaction-manager configuration element. This will autodetect BEA WebLogic and IBM WebSphere, registering the appropriate PlatformTransactionManager.
2.4.3. JPA

Spring 2.0 ships with a JPA abstraction layer that is similar in intent to Spring's JDBC abstraction layer in terms of scope and general usage patterns.

If you are interested in using a JPA-implementation as the backbone of your persistence layer, the section entitled Section 12.6, “JPA” is dedicated to detailing Spring's support and value-add in this area.

Spring 2.5 upgrades its OpenJPA support to OpenJPA 1.0, with support for advanced features such as savepoints.
2.4.4. Asynchronous JMS

Prior to Spring 2.0, Spring's JMS offering was limited to sending messages and the synchronous receiving of messages. This functionality (encapsulated in the JmsTemplate class) is great, but it doesn't address the requirement for the asynchronous receiving of messages.

Spring 2.0 now ships with full support for the reception of messages in an asynchronous fashion, as detailed in the section entitled Section 19.4.2, “Asynchronous Reception - Message-Driven POJOs”.

As of Spring 2.5, the JCA style of setting up asynchronous message listeners is supported as well, through the GenericMessageEndpointManager facility. This is an alternative to the standard JMS listener facility, allowing closer integration with message brokers such as ActiveMQ and JORAM. See Section 19.5, “Support for JCA Message Endpoints”.

Spring 2.5 also introduces an XML namespace for simplifying JMS configuration, offering concise configuration of a large numbers of listeners. This namespace supports both the standard JMS listener facility as well as the JCA setup style, with minimal changes in the configuration. See Section 19.6, “JMS Namespace Support”.
2.4.5. JDBC

There are some small (but nevertheless notable) new classes in the Spring Framework's JDBC support library. The first, NamedParameterJdbcTemplate, provides support for programming JDBC statements using named parameters (as opposed to programming JDBC statements using only classic placeholder ('?') arguments.

Another of the new classes, the SimpleJdbcTemplate, is aimed at making using the JdbcTemplate even easier to use when you are developing against Java 5+ (Tiger).

Spring 2.5 significantly extends the functionality of SimpleJdbcTemplate and introduces SimpleJdbcCall and SimpleJdbcInsert operation objects.

スプリング2.0内のトランザクションが構成される方法は著しく変化しました。しかし以前の1.2.xの設定方法も有効です。しかし新たなスタイルは冗長が減り、推奨されます。

ToDo 先に1.x系の習得を行うためいったん凍結