Versions Compared

Key

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

...

(tick) Spring integration is built into framework. In fact, Spring is the default object factory for SAF 2s2 is Spring.

Spring Integration

Spring integration is enabled by default. The default object factory is set in the struts.properties files.

Code Block
titleactionstruts.properties
action.objectFactory = spring

...

Initializing Actions from Spring

Normally, in actionstruts.xml you specify the class for each Action. When using the default SpringObjectFactory, the framework will ask Spring to create the Action and wire up dependencies as specified by the default auto-wire behavior.

...

However, sometimes you might want the bean to be completely managed by Spring. This is useful, for example, if you wish to apply more complex AOP or Spring-enabled technologies, such as Acegi, to your beans. To do this, all you have to do is configure the bean in your Spring applicationContext.xml and then change the class attribute from your Action in the action.xml to use the bean name defined in Spring instead of the class name.

Your actionstruts.xml file would then have the Action class attributes changed.

...