SSM(Spring+SpringMVC+Mybatis)框架搭建详细教程【附源代码Demo】 (2)

  

SSM(Spring+SpringMVC+Mybatis)框架搭建详细教程【附源代码Demo】

  

SSM(Spring+SpringMVC+Mybatis)框架搭建详细教程【附源代码Demo】

  - Java为主Java代码文件夹

    - Controllers 控制器文件文件夹

    - Dao (数据访问)层文件夹

    - Service(业务逻辑)层文件夹

    - Entity(实体)层文件夹

  - resources资源文件夹

    - mapper mybatis sql文件夹

  - webapp web页面文件夹

  - Test 测试文件夹

三、Maven包的初始化 Maven是采用配置文件的方式进行jar包的自动导入,因此,我们需要进行对配置文件的修改来进行jar包的导入。   打开pom.xml文件

  

SSM(Spring+SpringMVC+Mybatis)框架搭建详细教程【附源代码Demo】

   添加我们将会用到的一系列jar包配置(这里将我的配置直接复制过来,作为参考)

1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 "> 3 <modelVersion>4.0.0</modelVersion> 4 <groupId>QX_JFrame</groupId> 5 <artifactId>Demo</artifactId> 6 <packaging>war</packaging> 7 <version>1.0-SNAPSHOT</version> 8 <name>Demo Maven Webapp</name> 9 <url></url> 10 <dependencies> 11 <!--Unit Test - 单元测试--> 12 <dependency> 13 <groupId>junit</groupId> 14 <artifactId>junit</artifactId> 15 <version>4.12</version> 17 </dependency> 18 <!--Spring--> 19 <dependency> 20 <groupId>org.springframework</groupId> 21 <artifactId>spring-core</artifactId> 22 <version>4.3.5.RELEASE</version> 23 </dependency> 24 <dependency> 25 <groupId>org.springframework</groupId> 26 <artifactId>spring-aop</artifactId> 27 <version>4.3.5.RELEASE</version> 28 </dependency> 29 <dependency> 30 <groupId>org.springframework</groupId> 31 <artifactId>spring-orm</artifactId> 32 <version>4.3.5.RELEASE</version> 33 </dependency> 34 <!--Spring transaction--> 35 <dependency> 36 <groupId>org.springframework</groupId> 37 <artifactId>spring-tx</artifactId> 38 <version>4.3.5.RELEASE</version> 39 </dependency> 40 <dependency> 41 <groupId>org.springframework</groupId> 42 <artifactId>spring-test</artifactId> 43 <version>4.3.5.RELEASE</version> 44 </dependency> 45 <dependency> 46 <groupId>org.springframework</groupId> 47 <artifactId>spring-mock</artifactId> 48 <version>2.0.8</version> 49 </dependency> 50 <dependency> 51 <groupId>org.springframework</groupId> 52 <artifactId>spring-jdbc</artifactId> 53 <version>4.3.5.RELEASE</version> 54 </dependency> 55 <dependency> 56 <groupId>org.springframework</groupId> 57 <artifactId>spring-context</artifactId> 58 <version>4.3.5.RELEASE</version> 59 </dependency> 60 <dependency> 61 <groupId>org.springframework</groupId> 62 <artifactId>spring-context-support</artifactId> 63 <version>4.3.5.RELEASE</version> 64 </dependency> 65 <dependency> 66 <groupId>org.springframework</groupId> 67 <artifactId>spring-expression</artifactId> 68 <version>4.3.5.RELEASE</version> 69 </dependency> 70 <!--Spring Web + Spring MVC--> 71 <dependency> 72 <groupId>org.springframework</groupId> 73 <artifactId>spring-web</artifactId> 74 <version>4.3.1.RELEASE</version> 75 </dependency> 76 <dependency> 77 <groupId>org.springframework</groupId> 78 <artifactId>spring-webmvc</artifactId> 79 <version>4.3.1.RELEASE</version> 80 </dependency> 81 82 <dependency> 83 <groupId>com.github.pagehelper</groupId> 84 <artifactId>pagehelper</artifactId> 85 <version>3.7.3</version> 86 </dependency> 87 <dependency> 88 <groupId>com.github.jsqlparser</groupId> 89 <artifactId>jsqlparser</artifactId> 90 <version>0.9.1</version> 91 </dependency> 92 <!--mysql jdbc--> 93 <dependency> 94 <groupId>mysql</groupId> 95 <artifactId>mysql-connector-java</artifactId> 96 <version>5.1.38</version> 97 </dependency> 98 <!--c3p0--> 99 <dependency> 100 <groupId>c3p0</groupId> 101 <artifactId>c3p0</artifactId> 102 <version>0.9.1.2</version> 103 </dependency> 104 <!--NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config--> 105 <!-- https://mvnrepository.com/artifact/jstl/jstl --> 106 <dependency> 107 <groupId>jstl</groupId> 108 <artifactId>jstl</artifactId> 109 <version>1.2</version> 110 </dependency> 111 <!--file upload jar package--> 112 <!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload --> 113 <dependency> 114 <groupId>commons-fileupload</groupId> 115 <artifactId>commons-fileupload</artifactId> 116 <version>1.3.1</version> 117 </dependency> 118 <!-- https://mvnrepository.com/artifact/commons-io/commons-io --> 119 <dependency> 120 <groupId>commons-io</groupId> 121 <artifactId>commons-io</artifactId> 122 <version>2.4</version> 123 </dependency> 124 <!--json--> 125 <!-- https://mvnrepository.com/artifact/org.json/json --> 126 <dependency> 127 <groupId>org.json</groupId> 128 <artifactId>json</artifactId> 129 <version>20160212</version> 130 </dependency> 131 <!-- https://mvnrepository.com/artifact/net.sf.json-lib/json-lib --> 132 <dependency> 133 <groupId>net.sf.json-lib</groupId> 134 <artifactId>json-lib</artifactId> 135 <version>2.4</version> 136 </dependency> 137 <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang --> 138 <dependency> 139 <groupId>commons-lang</groupId> 140 <artifactId>commons-lang</artifactId> 141 <version>2.6</version> 142 </dependency> 143 <!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils --> 144 <dependency> 145 <groupId>commons-beanutils</groupId> 146 <artifactId>commons-beanutils</artifactId> 147 <version>1.8.3</version> 148 </dependency> 149 <!-- https://mvnrepository.com/artifact/commons-collections/commons-collections --> 150 <dependency> 151 <groupId>commons-collections</groupId> 152 <artifactId>commons-collections</artifactId> 153 <version>3.2.1</version> 154 </dependency> 155 <!-- https://mvnrepository.com/artifact/commons-logging/commons-logging --> 156 <dependency> 157 <groupId>commons-logging</groupId> 158 <artifactId>commons-logging</artifactId> 159 <version>1.2</version> 160 </dependency> 161 <!-- https://mvnrepository.com/artifact/net.sf.ezmorph/ezmorph --> 162 <dependency> 163 <groupId>net.sf.ezmorph</groupId> 164 <artifactId>ezmorph</artifactId> 165 <version>1.0.6</version> 166 </dependency> 167 <!--json serialize and deserialization--> 168 <!-- 引入fastjson依赖 --> 169 <dependency> 170 <groupId>com.alibaba</groupId> 171 <artifactId>fastjson</artifactId> 172 <version>1.2.12</version> 173 </dependency> 174 <!-- 引入gson依赖 --> 175 <dependency> 176 <groupId>com.google.code.gson</groupId> 177 <artifactId>gson</artifactId> 178 <version>2.6.2</version> 179 </dependency> 180 <!--Base64 加解密--> 181 <!-- https://mvnrepository.com/artifact/net.iharder/base64 --> 182 <dependency> 183 <groupId>net.iharder</groupId> 184 <artifactId>base64</artifactId> 185 <version>2.3.8</version> 186 </dependency> 187 <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec --> 188 <dependency> 189 <groupId>commons-codec</groupId> 190 <artifactId>commons-codec</artifactId> 191 <version>1.10</version> 192 </dependency> 193 <!--log4j--> 194 <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core --> 195 <dependency> 196 <groupId>org.apache.logging.log4j</groupId> 197 <artifactId>log4j-core</artifactId> 198 <version>2.6.2</version> 199 </dependency> 200 <dependency> 201 <groupId>org.jetbrains</groupId> 202 <artifactId>annotations-java5</artifactId> 203 <version>RELEASE</version> 204 </dependency> 205 <!--mybatis--> 206 <dependency> 207 <groupId>org.mybatis</groupId> 208 <artifactId>mybatis</artifactId> 209 <version>3.3.0</version> 210 </dependency> 211 <dependency> 212 <groupId>org.mybatis</groupId> 213 <artifactId>mybatis-spring</artifactId> 214 <version>1.2.3</version> 215 </dependency> 216 </dependencies> 217 <build> 218 <finalName>Demo</finalName> 219 </build> 220 </project>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwjgxy.html