struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Obinna <obi...@gmail.com>
Subject Struts2SpringObjectFactory autowiring and injecting static property values when
Date Mon, 24 Aug 2009 09:36:03 GMT
I'm using struts with the spring object factory

I'm trying to package some struts configuration such that I can define some
commonly reused actions in a base struts configuration file and extend in
multiple projects. This means that my struts configuration will be generic
but my spring configuration (which I use to inject project-specific
properties and other beans in to my action) will be project specific.

In this base struts configuration, since I can't predict what the struts
action beans will be named in the project-specific spring configuration
file, I need to provide the full class name for each action. However, when
used in a project (which extends this base struts configuration), I would
like to be able to inject properties into this action from my spring
configuration. In my spring configuration, I provide a bean entry for the
struts action and inject some other bean references and some static
properties. Using the default autowiring strategy, upon instantiation of the
action (prototype scope), the spring object factory recognizes the spring
configuration for the action and "autowires" it to inject ONLY THE OTHER
BEAN REFERENCES. ANY STATIC PROPERTIES SET IN CONFIGURATION ARE IGNORED.
Looking through the spring code, this is due to the standard implementation
of the the autowireByName()  method being called in Spring's
AbstractAutowireCapableBeanFactory class.

My question: Is there currently some combination of spring wiring
strategies/ struts configuration that will allow me to do what I want which
is to define my struts action by Class name and yet manage it it fully
(including static-property injection) from my spring configuration file? I
suspect others will have run in to this same issue before.

Thanks,
- Eric

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message