
Tapestry easily integrates with Spring Framework, allowing beans defined by Spring to be injected into Tapestry IoC services, and into Tapestry components. In addition, with Tapestry 5.2 and later, you can also go the other way, injecting Tapestry services in Spring beans.
For integrating Spring Security into your application, see Security.
Contents
To integrate Spring with Tapestry, you should add the below dependency in your classpath. The following exemple is for Maven users.
The short form is that you must make two small changes to your application's web.xml.

First, a special filter is used in replace of the standard TapestryFilter:
Secondly, you may add the normal Spring configuration, consisting of an optional <context-param> identifying which Spring bean configuration file(s) to load:
The <context-param> lists the Spring bean configuration file. It is optional and defaults to just /WEB-INF/applicationContext.xml if omitted.
By integrating Spring in Tapestry, you get full access on Spring ApplicationContext as if you were accessing to any Tapestry service. Simply @Inject into your pages and components.
Inside your component classes, you may use the @Inject annotation. Typically, just adding @Inject to the field type is sufficient to identify the Spring bean to inject:
Searching for Spring beans is threaded into the MasterObjectProvider service. The Spring context becomes one more place that Tapestry searches when determining the injection for a injected field or method parameter.
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-32014-1.html
只能用一次
公关出力了
让人匪夷所思
梦一场