Struts2中有一个Spring框架的插件。您只需在 Struts 操作类构造函数中定义适当的类型,插件将从 Spring 的 Web 应用程序上下文中检索适当的 bean。
There is a plugin for Spring framework in Struts2. You just define appropriate types in your Struts action class constructor and plugin will retrieve appropriate bean from Spring's web app context.
发布评论
评论(4)
恰恰相反。您可以将 Spring 配置为与 Struts 一起使用,例如 这个。
It's the other way round. You configure Spring to work with Struts like this.
Struts2中有一个Spring框架的插件。您只需在 Struts 操作类构造函数中定义适当的类型,插件将从 Spring 的 Web 应用程序上下文中检索适当的 bean。
There is a plugin for Spring framework in Struts2. You just define appropriate types in your Struts action class constructor and plugin will retrieve appropriate bean from Spring's web app context.
Spring 提供了一些开箱即用的支持:
http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/struts/DelegatingActionProxy.html
Spring provides some support out of the box:
http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/web/struts/DelegatingActionProxy.html
Spring 附带了 Struts 特定的“spring-struts.jar”解决方案,用于在 Spring Ioc 容器中声明的访问 bean。
在Struts配置文件中注册Spring现成的Struts插件。
ActionSupport
类(Struts Action 类的子类)。ActionSupport
提供了一个方便的getWebApplicationContext()
方法,供您访问 Spring Ioc 容器中声明的 bean。来源
Spring comes with Struts-specific “spring-struts.jar” solution for access beans declared in the Spring Ioc container.
Register a Spring’s ready-make Struts plug-in in the Struts configuration file.
ActionSupport
class, a subclass of the Struts Action class.ActionSupport
provide a convenientgetWebApplicationContext()
method for you to access beans declared in Spring Ioc container.source