SSM framework building and learning (3) --- integrate the Spring framework into the final SSM framework, ssm --- spring
With the integration of SpringMVC and Mabatis, a preliminary WEB framework is formed, but the complete SSM framework still needs Spring support!
So far, the configuration file we have added includes the core configuration file web. xml, springmvc configuration file spring-servlet.xml and Mabatis configuration file mybatis-config.xml, then there is the last Spring configuration file applicationContext. xml.
1) Add the following Spring configuration information to web. xml
Step 1: Load listener
<Listener>
<Listener-class> org. springframework. web. context. ContextLoaderListener </listener-class>
</Listener>
Step 2: specify the location and name of the spring configuration file.
<Context-param>
<Param-name> contextConfigLocation </param-name>
<Param-value>/WEB-INF/applicationContext. xml </param-value>
</Context-param>
1) Add the following configuration information to the Spring configuration file applicationContext. xml:
OK, with the Spring configuration file, a complete SSM framework has been formed, but here we should note that this is only the most basic SSM framework and the most basic WEB framework, we do not respect any other auxiliary enhanced frameworks. We only have this basic framework in our daily work. It is far from enough in terms of efficiency or development suggestions, we can use this as the basis to expand the desired structure (such as creating a Maven project rather than the original web project amount !).