You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Josep María Formentí Serra <jm...@aia.es> on 2010/11/12 17:37:19 UTC

Spring context for package

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
jmformenti@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.

Re: Spring context for package

Posted by Dave Newton <da...@gmail.com>.
As far as I know there's nothing in the Spring plugin that currently
provides that functionality.

Dave

2010/11/12 Josep María Formentí Serra <jm...@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
> jmformenti@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.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Spring context for package

Posted by Josep María Formentí Serra <jm...@aia.es>.
Well, the project that we are building have a common part (now only user
administration) and then we have two independent modules (with some links
between theirs). In this case, it would be a good solution use an ear, but
some clients are working in tomcat, then we are working with a war.

Really, the only problem that we have now, is that usually we have conflict
with spring bean names then we have two rename one bean to avoid the
problem.

Thanks,
Josep Maria


2010/11/24 <st...@gmail.com>

> Josep --
>
> That sounds a little radical.  Do you mind if I ask why?  Is the unique
> namespace per package not enough separation?  Hey, if strict separation is
> what you desire, you could package each S2 package in it's own project and
> move the package namespace to the web root context and be done with it.  Is
> your multi-package web application really multiple web applications?
>
> Peace,
> Scott
>
> 2010/11/24 Josep María Formentí Serra <jm...@aia.es>
>
> > Scott, it's interesting, I didn't know that, but i would like to have
> > different application context in the same war, specifically, i would like
> > to
> > have an application context for each package that is defined in
> struts.xml.
> >
> > Thanks,
> > Josep Maria
> >
> >
> > 2010/11/17 <st...@gmail.com>
> >
> > > Josep  --
> > >
> > > I believe this is what you are looking for.
> > >
> > >
> > >
> >
> http://blog.springsource.com/2007/06/11/using-a-shared-parent-application-context-in-a-multi-war-spring-application/
> > >
> > > Peace,
> > > Scott
> > >
> > > 2010/11/17 Josep María Formentí Serra <jm...@aia.es>
> > >
> > > > 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 <th...@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 <jm...@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
> > > > > > jmformenti@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
> > > > jmformenti@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
> > jmformenti@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
jmformenti@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.

Re: Spring context for package

Posted by st...@gmail.com.
Josep --

That sounds a little radical.  Do you mind if I ask why?  Is the unique
namespace per package not enough separation?  Hey, if strict separation is
what you desire, you could package each S2 package in it's own project and
move the package namespace to the web root context and be done with it.  Is
your multi-package web application really multiple web applications?

Peace,
Scott

2010/11/24 Josep María Formentí Serra <jm...@aia.es>

> Scott, it's interesting, I didn't know that, but i would like to have
> different application context in the same war, specifically, i would like
> to
> have an application context for each package that is defined in struts.xml.
>
> Thanks,
> Josep Maria
>
>
> 2010/11/17 <st...@gmail.com>
>
> > Josep  --
> >
> > I believe this is what you are looking for.
> >
> >
> >
> http://blog.springsource.com/2007/06/11/using-a-shared-parent-application-context-in-a-multi-war-spring-application/
> >
> > Peace,
> > Scott
> >
> > 2010/11/17 Josep María Formentí Serra <jm...@aia.es>
> >
> > > 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 <th...@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 <jm...@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
> > > > > jmformenti@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
> > > jmformenti@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
> jmformenti@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.
>

Re: Spring context for package

Posted by Josep María Formentí Serra <jm...@aia.es>.
Scott, it's interesting, I didn't know that, but i would like to have
different application context in the same war, specifically, i would like to
have an application context for each package that is defined in struts.xml.

Thanks,
Josep Maria


2010/11/17 <st...@gmail.com>

> Josep  --
>
> I believe this is what you are looking for.
>
>
> http://blog.springsource.com/2007/06/11/using-a-shared-parent-application-context-in-a-multi-war-spring-application/
>
> Peace,
> Scott
>
> 2010/11/17 Josep María Formentí Serra <jm...@aia.es>
>
> > 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 <th...@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 <jm...@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
> > > > jmformenti@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
> > jmformenti@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
jmformenti@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.

Re: Spring context for package

Posted by st...@gmail.com.
Josep  --

I believe this is what you are looking for.

http://blog.springsource.com/2007/06/11/using-a-shared-parent-application-context-in-a-multi-war-spring-application/

Peace,
Scott

2010/11/17 Josep María Formentí Serra <jm...@aia.es>

> 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 <th...@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 <jm...@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
> > > jmformenti@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
> jmformenti@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.
>

Re: Spring context for package

Posted by Josep María Formentí Serra <jm...@aia.es>.
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 <th...@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 <jm...@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
> > jmformenti@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
jmformenti@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.

Re: Spring context for package

Posted by Chris Pratt <th...@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 <jm...@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
> jmformenti@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.
>