开发者

Spring framework structure

I am trying to understand the spring framework architecture (learning to use spring as well), and setup the framework source i开发者_Go百科n eclipse. Can anyone point to where the bootstrap of the framework occurs if I refer spring core in my application. I see the core package, but not sure where to look for. A brief note on how the framework is initialized would be highly helpful.

thanks.


The first JAR in Spring is spring-core, but it doesn't do anything special from programmer's point of view. The first really important JAR is spring-beans (which also uses spring-core). And one of most important classes in spring-beans is XMLBeanFactory - using it you bootstrap Spring in any, even a small desktop application. On this JAR depend other, more complex: spring-context, spring-web, etc...

You can always see what depends on what with Maven, and if you don't have Maven, you can use eg mvnrepository.com: http://mvnrepository.com/artifact/org.springframework/spring-beans/3.0.5.RELEASE


Assuming that you are talking about a Springified webapp, its /WEB-INF/web.xml file will typically contain servlet declarations like this:

<servlet>
    <servlet-name>example</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

The DispatcherServlet will cause the framework to initialize, triggered (I think) by the servlet initialization event.

There are other ways too ...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜