One: Overview
The SSM framework is often used in project development, and it is applied more broadly in only a few years of development compared to the SSH framework. Spring, as a lightweight framework, has a lot of expansion capabilities, the most important of which is the IOC and AOP used in our general projects. SPRINGMVC is a Web layer implemented by spring, equivalent to the struts framework, but more flexible and powerful than struts. MyBatis is a persistent layer framework that is more flexible to use than hibernate and can control the writing of SQL, using XML or annotations for related configurations.
According to the above description, learning the SSM framework is very important.
II: Build a SSM process using MAVEN to manage projects
Using MAVEN to create a WebApp project in Eclipse, the specific creation process does not demonstrate, as there is no creation of [Create project]
You can also use the MAVEN command to create, enter the specified directory in a DOS window, and execute the following command:
MVN Archetype:create-dgroupid=org.ssm.dufy-dartifactid=ssm-demo-darchetypeartifactid=maven-archetype-webapp- Dinteractivemode=false
Use the command to be aware that the system has MAVEN installed and the environment variable is configured. [MAVEN Installation and environment variable configuration]
Import project (named Creation), add dependency
The import project is in the IDE, or it is created directly in the IDE, with the general default of "Src/main/java" and manually creating the "Src/test/resources", "Src/test/java" folder.
The following project structure:
Then directly configure the package dependencies in the Pom.xml file.
<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" > <modelversion >4.0.0</modelVersion> <groupId>org.dufy</groupId> <artifactId>ssm</artifactId> & Lt;packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> <name>ssmdemo</name > <url>http://maven.apache.org</url> <properties> <spring.version>4.0.5.release</sp Ring.version> <mybatis.version>3.2.1</mybatis.version> <slf4j.version>1.6.6</ Slf4j.version> <log4j.version>1.2.12</log4j.version> <mysql.version>5.1.35</ Mysql.version> </properties> <dependencies> <!--Add Spring dependency--<dependency>
; <groupId>org.springframework</groupId> <artiFactid>spring-core</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactid>spring-context </artifactId> <version>${spring.version}</version> </dependency> <dependency>
;
<groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> <dependency> <GROUPID&G T;org.springframework</groupid> <artifactId>spring-aop</artifactId> <VERSION>${SPR ing.version}</version> </dependency> <dependency> <groupId>org.springframework< /groupid> <artifactId>spring-aspects</artifactId> <version>${spring.version}</vers Ion> ≪/dependency> <dependency> <groupId>org.springframework</groupId> <artifactid >spring-tx</artifactId> <version>${spring.version}</version> </dependency> < Dependency> <groupId>org.springframework</groupId> <artifactid>spring-jdbc</artifa ctid> <version>${spring.version}</version> </dependency> <dependency> & Lt;groupid>org.springframework</groupid> <artifactId>spring-web</artifactId> <vers
Ion>${spring.version}</version> </dependency> <!--spring Unit test dependent--<dependency> <groupId>org.springframework</groupId> <ARTIFACTID>SPRING-TEST</ARTIFACTID&G
T
<version>${spring.version}</version> <scope>test</scope> </dependency> <!--Spring WEBMVC related jars--<dependency> <groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId> <version>${spring.version}</version>
</dependency> <dependency> <groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId> <version>${spring.version}</version>
</dependency> <!--mysql Driver Pack---<dependency> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> </dependency> <!--Alibaba data source related jar---<dependency> <groupid>com.
Alibaba</groupid> <artifactId>druid</artifactId> <version>0.2.23</version> </dependency>
<!--Alibaba Fastjson formatting--<dependency> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <version>1.1.41</version> </dependency> <!--logback Start-to-<dependency> <groupid>log4j</group Id> <artifactId>log4j</artifactId> <version>${log4j.version}</version> < /dependency> <dependency> <groupId>org.slf4j</groupId> <artifactid>slf4j-ap i</artifactid> <version>${slf4j.version}</version> </dependency> <dependency>
; <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <ver sion>1.1.2</version> </dependency> <dependency> <groupid>ch.qos.logback</gro Upid> <artifactId>logback-core</artifactId> <version>1.1.2</version> </de pendency> <dependency> <groupId>org.logback-extensions</groupId> <ARTIFACTID&G T;logback-ext-spring</artifactid> <version>0.1.1</version> </dependency> < !--MyBatis Dependent-<dependency> <groupId>org.mybatis</groupId> <artifactid>my Batis</artifactid> <version>${mybatis.version}</version> </dependency> <!--my Batis/spring Package--<dependency> <groupId>org.mybatis</groupId> <artifactid>m Ybatis-spring</artifactid> <version>1.2.0</version> </dependency> <!--add Servlet3 .0 Core Pack-<dependency> <groupId>javax.servlet</groupId> <art Ifactid>javax.servlet-api</artifactid> <version>3.0.1</version> </dependency> <DEP Endency> <groupId>javax.servlet.jsp</groupId> <ARTIFACTID>JAVAX.SERVLET.J Sp-api</artifactid> <version>2.3.2-b01</version> </dependency> & lt;! --Jstl <dependency> <groupId>javax.servlet</groupId> <a rtifactid>jstl</artifactid> <version>1.2</version> </dependency> &L t;! --Unit Test dependent-<dependency> <groupId>junit</groupId> <artifactid>junit</artifa ctid> <version>3.8.1</version> <scope>test</scope> </dependency> </d
ependencies> <build> <finalName>ssmDemo</finalName> </build>