Thanks Dave and Chris,

Chris, that it's nice, we are going to modify it in our project. But our
real problem is that we have two independent modules (and struts package for
each one) and many spring beans have the same name. Then we have to change
bean names when we detect a conflict. I think it will be better have a
separated spring context for module (or struts package).

I think that one solution is use an struts interceptor to get the spring
beans (something like
com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor) but
my knowledge about that it's very poor.

Josep Maria

2010/11/12 Chris Pratt <thechrispr...@gmail.com>

> If you are talking about per Java package, not that I know of.  If you mean
> per Struts package, same thing.  But if you mean per jar file, there is a
> way.  If you set your contextConfigLocation to something like
> "WEB-INF/applicationContext.xml,classpath*:pluginContext.xml" then Spring
> will load your Application wide context from the WEB-INF directory (or you
> can make that WEB-INF/classes if you want), then it will load each
> pluginContext.xml file it finds on the CLASSPATH.  Since the root directory
> of each jar file in the WEB-INF/lib directory is considered to be on the
> CLASSPATH, it will automatically include those beans, kind of like the
> start
> of a Plug-In architecture.  You can so a similar thing with the
> struts-plugin.xml support built into Struts 2 to make a pretty robust
> Plug-in system in your application.
>   (*Chris*)
>
> 2010/11/12 Josep María Formentí Serra <jmforme...@aia.es>
>
> > Hi,
> >
> > We are working in a new project using struts2 + spring + hibernate. We
> have
> > many packages defined in struts.xml, one for module. We have configured
> > spring using this guide:
> > http://struts.apache.org/2.0.14/docs/spring-plugin.html, where you
> define
> > one spring context (using the context param: contextConfigLocation). Is
> it
> > possible to define a different spring context for each struts package?
> >
> > Thanks in advance,
> >  Josep Maria
> >
> > --
> > ------------------------------------------------------------------- -- -
> -
> > -
> > Grupo AIA - http://www.aia.es
> > Josep Mª Formentí Serra
> > jmforme...@aia.ptv.es
> > Telf.: +34 93 504 49 00 Fax.: +34 93 580 21 88
> > ------------------------------------------------------------------- -- -
> -
> > -
> >
> > _________________________________________________________________ ___ __
> _
> > _
> > _ _
> >
> > The information transmitted is intended only for the person or entity to
> > which it is addressed and may contain confidential and/or privileged
> > material. Any review, retransmission, dissemination or other use of, or
> > taking of any action in reliance upon, this information by persons or
> > entities other than the intended recipient is prohibited. If you received
> > this in error, please contact the sender and delete the material from any
> > computer.
> >
>



-- 
------------------------------------------------------------------- -- - - -
Grupo AIA - http://www.aia.es
Josep Mª Formentí Serra
jmforme...@aia.ptv.es
Telf.: +34 93 504 49 00 Fax.: +34 93 580 21 88
------------------------------------------------------------------- -- - - -

_________________________________________________________________ ___ __ _ _
_ _

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.

Reply via email to