One, SPRINGMVC---controller spring----service Mybatiss---DAO
Pring (including SPRINGMVC), MyBatis, mybatis-spring integration packs, database drivers, third-party connection pools.
Because Springmvc and spring belong to the same company without a consolidation package, mybaits and spring need to integrate the package.
Ii. List of JAR packages
Pom file dependencies:
1<dependencies>2<dependency>3<groupId>org.hamcrest</groupId>4<artifactId>hamcrest-library</artifactId>5<version>1.3</version>6</dependency>7<dependency>8<groupId>org.springframework</groupId>9<artifactId>spring-webmvc</artifactId>Ten<version>4.3. A. Release</version> One</dependency> A<dependency> -<groupId>org.slf4j</groupId> -<artifactId>slf4j-log4j12</artifactId> the<version>1.7.5</version> -</dependency> -<dependency> -<groupId>org.slf4j</groupId> +<artifactId>slf4j-api</artifactId> -<version>1.7.5</version> +</dependency> A<dependency> at<groupId>org.apache.logging.log4j</groupId> -<artifactId>log4j-core</artifactId> -<version>2.0.2</version> -</dependency> -<dependency> -<groupId>org.apache.logging.log4j</groupId> in<artifactId>log4j-api</artifactId> -<version>2.0.2</version> to</dependency> +<dependency> -<groupId>spring-jms</groupId> the<artifactId>spring-jms</artifactId> *<version>4.2.4</version> $</dependency>Panax Notoginseng<dependency> -<groupId>org.springframework</groupId> the<artifactId>spring-web</artifactId> +<version>4.3. A. Release</version> A</dependency> the<dependency> +<groupId>mysql</groupId> -<artifactId>mysql-connector-java</artifactId> $<version>5.1. the</version> $</dependency> -<dependency> -<groupId>taglibs-standard</groupId> the<artifactId>taglibs-standard</artifactId> -<version>1.2.5</version>Wuyi</dependency> the<dependency> -<groupId>taglibs-standard-spec</groupId> Wu<artifactId>taglibs-standard-spec</artifactId> -<version>1.2.5</version> About</dependency> $<dependency> -<groupId>org.springframework</groupId> -<artifactId>spring-oxm</artifactId> -<version>4.1.5. Release</version> A</dependency> +<dependency> the<groupId>org.springframework</groupId> -<artifactId>spring-test</artifactId> $<version>4.3. A. Release</version> the</dependency> the the<dependency> the<groupId>org.springframework</groupId> -<artifactId>spring-expression</artifactId> in<version>4.3. A. Release</version> the</dependency> the<dependency> About<groupId>org.springframework</groupId> the<artifactId>spring-core</artifactId> the<version>4.3. A. Release</version> the</dependency> +<dependency> -<groupId>org.springframework</groupId> the<artifactId>spring-beans</artifactId>Bayi<version>4.3. A. Release</version> the</dependency> the<dependency> -<groupId>org.springframework</groupId> -<artifactId>spring-context</artifactId> the<version>4.3. A. Release</version> the</dependency> the<dependency> the<groupId>org.springframework</groupId> -<artifactId>spring-context-support</artifactId> the<version>4.3. A. Release</version> the</dependency> the<dependency>94<groupId>org.springframework</groupId> the<artifactId>spring-aop</artifactId> the<version>4.3. A. Release</version> the</dependency>98<dependency> About<groupId>aopalliance</groupId> -<artifactId>aopalliance</artifactId>101<version>1.0</version>102</dependency>103<dependency>104<groupId>spring-aspects</groupId> the<artifactId>spring-aspects</artifactId>106<version>4.2.4</version>107</dependency>108<dependency>109<groupId>com.springsource.org</groupId> the<artifactId>aspectj.weaver</artifactId>111<version>1.6.8</version> the</dependency>113 the<dependency> the<groupId>org.apache.commons</groupId> the<artifactId>commons-pool2</artifactId>117<version>2.4.1</version>118</dependency>119 -<dependency>121<groupId>org.apache.commons</groupId>122<artifactId>commons-dbcp2</artifactId>123<version>2.0.1</version>124</dependency> the<dependency>126<groupId>org.springframework</groupId>127<artifactId>spring-jdbc</artifactId> -<version>4.1.5. Release</version>129</dependency> the<dependency>131<groupId>log4j</groupId> the<artifactId>log4j</artifactId>133<version>1.2. -</version>134</dependency>135<dependency>136<groupId>org.javassist</groupId>137<artifactId>javassist</artifactId>138<version>3.16.1-ga</version>139</dependency> $<dependency>141<groupId>org.mybatis</groupId>142<artifactId>mybatis-spring</artifactId>143<version>1.2.2</version>144</dependency>145<dependency>146<groupId>org.springframework</groupId>147<artifactId>spring-tx</artifactId>148<version>4.1.5. Release</version>149</dependency> Max<dependency>151<groupId>commons-logging</groupId> the<artifactId>commons-logging</artifactId>153<version>1.1.1</version>154</dependency>155<dependency>156<groupId>cglib</groupId>157<artifactId>cglib</artifactId>158<version>2.2.2</version>159</dependency> the<dependency>161<groupId>asm</groupId>162<artifactId>asm</artifactId>163<version>3.3.1</version>164</dependency>165<dependency>166<groupId>org.mybatis</groupId>167<artifactId>mybatis</artifactId>168<version>3.2.7</version>169</dependency> the<dependency>171<groupId>junit</groupId>172<artifactId>junit</artifactId>173<version>4.11</version>174<scope>test</scope>175</dependency>176<dependency>177<groupId>org.junit.jupiter</groupId>178<artifactId>junit-jupiter-api</artifactId>179<version>RELEASE</version> the</dependency>181<dependency>182<groupId>org.springframework</groupId>183<artifactId>spring-test</artifactId>184<version>4.3. A. Release</version>185</dependency>
Iii. Configuration Files
1,sqlmapconfig.xml: mybaits configuration file, only save constraints and configuration tags, where the mapper map in the applicationcontex-dao.xml to add.
1<?xml version="1.0"encoding="UTF-8"?>2<!DOCTYPE Configuration3Public"-//mybatis.org//dtd Config 3.0//en"4 "HTTP://MYBATIS.ORG/DTD/MYBATIS-3-CONFIG.DTD">5 6 7<configuration>8</configuration>
2.applicationcontext-dao.xmL:dao layer configuration file
1) Database Connection pool
2) Session Factory
3) Configure Mapper Scan
3. Service Layer
1) The annotations on theapplicationcontext-service.xml packet scanner and service layer are turned on.
2)applicationcontext-trans.xml transaction configuration file.
4,springmvc.xml
1) Note Scanner Open
2) Note Driver (processor Mapper and processor adapter)
3) View parser configuration
5.Web. XML Front controller configuration.
JAVA Springmvc+spring+mybatis Integration