Sharing beans from contextListener -- dispatcher servlet
Posted
by Ernest
on Stack Overflow
See other posts from Stack Overflow
or by Ernest
Published on 2010-06-10T21:42:28Z
Indexed on
2010/06/10
21:53 UTC
Read the original article
Hit count: 313
Hello! ok, i have another question now. I have a bunch of beans loaded succesfully in applicationContext.xml, which loads from web.xml:
contextConfigLocation applicationContext.xml org.springframework.web.context.ContextLoaderListener
Here are is the bean defined in applicationContext.xml that i want to share:
it loads other beans (DAOs) which are initialized with hibernet.
I need to acces catalogFacadeTarget from the dispatcherServlet, declared in web.xml:
dispatcher org.springframework.web.servlet.DispatcherServlet 1
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
and configured dispatcher-servlet.xml like this:
welcome
There! in the property called catalogFacadeImpl.
If you need the entire applicationCOntext.xml, web.xml, and dispatcher-servlet.xml please let me know.
From what i read, i should be able to share beans if i declared them in the contextConfigLocation configuration file.
Thank you very much in advance.
© Stack Overflow or respective owner