java - Spring: - How can we get Bean if context are loaded from web.xml? -


i learning spring being used in project.i found contextconfiglocation entry in web.xml

 /web-inf/context/*-context.xml  classpath:/context/database-context.xml  classpath:/context/database-service-context.xml  classpath:/context/business-process-management-service-context.xml 

and listener

<listener>     <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> 

in core project read below

 resource r=new classpathresource("applicationcontext.xml");    beanfactory factory=new xmlbeanfactory(r);    employee s=(employee)factory.getbean("e");  

but not figure out how things working , getbean() function called ?

you can retrieve webcontext method:

http://docs.spring.io/spring/docs/3.0.x/javadoc-api/org/springframework/web/context/support/webapplicationcontextutils.html#getwebapplicationcontext%28javax.servlet.servletcontext%29


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -