Hi Rob,

You can also use the Spring APIs directly and skip the annotation and
SpringHelper...

I mean, calling beanFactory.getBean("myBean") doesn't hurt if you do it
only there.

You can access the servletContext at init time :
http://stripes.sourceforge.net/docs/current/javadoc/net/sourceforge/stripes/localization/DefaultLocalePicker.html#init(net.sourceforge.stripes.config.Configuration)

So store a ref to your ApplicationContext (WebApplicationContext if I
remember well, it's been a while with Spring), and invoke getBean() when
necessary...

Cheers

Remi





2013/6/13 Freddy Daoud <xf2...@fastmail.fm>

> If you have the Stripes book, there are more details about this
> in the "Dependency Injection with Spring" section. In summary,
> you have to subclass the Stripes default locale picker factory,
> call the superclass method to create the object, and use
> SpringHelper.injectBeans( ) on the object before returning it.
>
> Cheers,
> Freddy
>
> On Thu, Jun 13, 2013, at 07:24 AM, Rob GB wrote:
>
> Hi all,
>
> I created my own LocalePicker implementation, I just created a new
> class and mapped it in web.xml:
>
>         <!-- Override the default localepicker class -->
>         <init-param>
>             <param-name>LocalePicker.Class</param-name>
>             <param-value>com.my.own.LocalePicker</param-value>
>         </init-param>
>
> it works, however I have Spring integrated in my app, so I need to
> inject a Spring bean, I tried this:
>
> public class LocalePicker extends DefaultLocalePicker {
> MyBean myBean;
>
>     @SpringBean("myBean")
>     protected void setMyBean(MyBean mybean) {
>         this.myBean = myBean;
>     }
>
>
> It's not working, the "myBean" bean is properly created by Spring but I
> cannot inject it in my overriden default locale picker.
>
> Kindly advice, thanks.
>
> ///RGB
>
>
>
> -----------------------------------------------------------------------
> -------
>
> This SF.net email is sponsored by Windows:
>
>
>
> Build for Windows Store.
>
>
>
> [1]http://p.sf.net/sfu/windows-dev2dev
>
> _______________________________________________
>
> Stripes-users mailing list
>
> [2]Stripes-users@lists.sourceforge.net
>
> [3]https://lists.sourceforge.net/lists/listinfo/stripes-users
>
> References
>
> 1. http://p.sf.net/sfu/windows-dev2dev
> 2. mailto:Stripes-users@lists.sourceforge.net
> 3. https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to