I have a bean 'Foo' that I need to be able to access from
outside the usual IoC machinery to be able to set property
values. I can't pull it out of Spring altogether because other
beans depend on it.
Specifically I want to be able to re-set the value of a property
in bean Foo in the code of a custom JSP tag I wrote. JSP tags
(so far as I can determine) get created and destroyed when
used, so cannot be pre-configured inside IoC (right?).
What I'd like to do inside my tag implementation code is
something like this:
Unfortunately I haven't found where I can get to this kind of
// Inside my JSP tag implementation code...
XmlWebApplicationContext context = XmlWebApplicationContext.getInstance();
FooClass foo = (FooClass) context.getBean("Foo");
// Now new value of property blah is useable inside Spring
// app context beans that depend on Foo.
"getInstance()" access to my app context.
Anyone know how to do this?
P.S. I did see ContextSingletonBeanFactoryLocator but wasn't
sure how to use it (or if this is the best way to get what I need).
I wanted to be sure that the context returned was in the same
context my Spring web-app is using so that the changes I make
to Foo in my JSP tag code will be visible in other app context
beans (i.e. the framework didn't just create a separate instance
of an app context using the same XML files!).