Hello all,
I am pretty new to spring. Recently joined a new job where spring framework is used and needed to understand this.
How does the ApplicationContext gets instantiated, when the server starts up. Is it provided automatically by the framework or do we create it in our Code.
Here is the piece of code we have, that I dont understand.
web.xml
<
servlet>
<servlet-name>business</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
**********************************************************************
business-servlet.xml has a class called Businessregistry that is declared in the business-servlet.xml
business-sevlet.xml also has all the other business or service objects also.
business-servlet.xml
<bean class="com.weather.north.Businessregistry" />
**********************************************************
BusinessRegistry is a ApplicationContextAware that has the ClassPathXMLApplicationContext which is instantiated as below
Class BusinessRegistry {
context =null;
filename = "weather-Client.xml";
public void setApplicationContext(ApplicationContext context) {
this.context = context;
}
private static synchronized void init(
String fileName)
{
if (isInitialised()) return;
log.info("Initialising registry [" + fileName + "]");
context = new ClassPathXmlApplicationContext(fileName);
}
***************
So, as you see the context seems to be getting intialised with the weather-client.xml which has all the proxy beans defnitition in it, which I dont understand.
Any explanantion of how ApplicationContext is created at start up of app server is appreciateed. Also, this is a
Java swing client app
THanks,
Mary