Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To use session-scoped components with Spring and Struts, see the Spring Session Components Workarounds analysis.

Class Reloading

The Spring plugin can be configured to automatically reload classes that change in the file system. This feature will enable code changes to be "hot deployed" without having to restart the web container. To enable this feature follow these steps:

  1. Set "struts.devMode" to "true"
  2. Set "struts.class.reloading.watchList" to a comma separated list of directories, or jar files (absolute paths)
  3. Add this to web.xml:
    Code Block
    typexml
    
       <context-param>
           <param-name>contextClass</param-name>
           <param-value>org.apache.struts2.spring.ClassReloadingXMLWebApplicationContext</param-value>
       </context-param> 
    
  4. Add Apache Commons JCI FAM to the classpath. If you are using maven, add this to pom.xml
    Code Block
    typexml
    
       <dependency>
           <groupId>org.apache.commons</groupId>
           <artifactId>commons-jci-fam</artifactId>
           <version>1.0</version>
       </dependency> 
    
Warning

This feature is experimental, and should never be used in production systems.

Settings

The following settings can be customized. See the developer guide.

Setting

Description

Default

Possible Values

struts.objectFactory.spring.autoWire

The autowire strategy

name

name,type,auto, or constructor

struts.objectFactory.spring.autoWire.alwaysRespect

Whether the autowire strategy should always be used, or if the framework should try to guess the best strategy based on the situation

false for backwards-compatibility

true or false

struts.objectFactory.spring.useClassCache

Whether to have Spring use its class cache or not

true

true or false

struts.class.reloading.watchList

List of jar files or directories to watch for changes

null

Comma separated list of absolute paths to jars or directories

Installation

This plugin can be installed by copying the plugin jar into your application's /WEB-INF/lib directory. No other files need to be copied or created.