Table of Contents |
---|
Description
Info |
---|
Spring is a lightweight container, providing centralized, automated configuration and wiring of your application objects, using a technique called "Dependency Injection" |
...
- Configure the Spring listener
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> |
- Register your objects via the Spring configuration
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans default-autowire="autodetect"> <bean id="personManager" class="com.acme.PersonManager" scope="prototype"/> ... </beans> |
...
Your struts.xml
file would then have the Action class attributes changed.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <include file="struts-default.xml"/> <package name="default" extends="struts-default"> <action name="foo" class="com.acme.Foo"> <result>foo.ftl</result> </action> </package> <package name="secure" namespace="/secure" extends="default"> <action name="bar" class="bar"> <result>bar.ftl</result> </action> </package> </struts> |
...
A typical spring configuration for bar could look as following.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans default-autowire="autodetect"> <bean id="bar" class="com.my.BarClass" singleton="false"/> ... </beans> |
...
Setting | Description | Default | Possible Values |
---|---|---|---|
| The autowire strategy |
|
|
| Whether the autowire strategy should always be used, or if the framework should try to guess the best strategy based on the situation |
|
|
| Whether to have Spring use its class cache or not |
|
|
| List of jar files or directories to watch for changes |
| Comma separated list of absolute or relative paths to jars or directories |
| List of regular expressions of accepted class names |
| Comma separated list of regular expressions of classes that will be loaded by the reloading class loader(we suggest to add regular expressions so only action classes are handled by the reloading class loader) |
| Reload the runtime configuration (action mappings, results etc) when a change is detected in one of the watched directories |
|
|
DEPRECATED: struts.classobjectFactory.spring.enableAopSupport | Uses different logic to construct beans to allow support AOP, it uses an old approach to create a bean, switch this flag if you have problems with Spring beans and AOP |
|
|
Installation
...