系统搭建的配置大同小异,本文在前人的基础上做了些许的改动,重写数据库,增加依据权限的动态菜单的实现,也增加了后台返回json格式数据的配置,详细参见完整源码

 

主要的后端架构:Spring+SpringMVC+Mybatis+Shiro+Maven 

IDE:IntelliJ IDEA 15.0.2

jdk:1.8.0_66

 

系统完整源码

https://github.com/Wellat/Factor

 

系统目录结构

基于Spring+SpringMVC+Mybatis的Web系统搭建

 

跑起来效果

基于Spring+SpringMVC+Mybatis的Web系统搭建

基于Spring+SpringMVC+Mybatis的Web系统搭建

 

 

搭建步骤

1、用Idea创建maven项目

2、配置pom.xml文件,添加依赖

  1 <?xml version="1.0" encoding="UTF-8"?>
  2 <project xmlns="http://maven.apache.org/POM/4.0.0"
  3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5     <modelVersion>4.0.0</modelVersion>
  6 
  7     <groupId>com.hemi</groupId>
  8     <artifactId>factor</artifactId>
  9     <version>1.0.0</version>
 10     <packaging>war</packaging>
 11 
 12     <build>
 13         <finalName>factor</finalName>
 14         <plugins>
 15             <!-- Mybatis generator代码生成插件 配置 -->
 16             <plugin>
 17                 <groupId>org.mybatis.generator</groupId>
 18                 <artifactId>mybatis-generator-maven-plugin</artifactId>
 19                 <version>${plugin.mybatis.generator}</version>
 20                 <configuration>
 21                     <configurationFile>${mybatis.generator.generatorConfig.xml}</configurationFile>
 22                     <overwrite>true</overwrite>
 23                     <verbose>true</verbose>
 24                 </configuration>
 25             </plugin>
 26 
 27             <!--Maven编译插件 配置-->
 28             <plugin>
 29                 <groupId>org.apache.maven.plugins</groupId>
 30                 <artifactId>maven-compiler-plugin</artifactId>
 31                 <version>${plugin.maven-compiler}</version>
 32                 <configuration>
 33                     <source>${project.build.jdk}</source>
 34                     <target>${project.build.jdk}</target>
 35                     <encoding>${project.build.sourceEncoding}</encoding>
 36                 </configuration>
 37             </plugin>
 38         </plugins>
 39 
 40         <!--配置Maven 对resource文件 过滤 -->
 41         <resources>
 42             <resource>
 43                 <directory>src/main/resources</directory>
 44                 <includes>
 45                     <include>**/*.properties</include>
 46                     <include>**/*.xml</include>
 47                 </includes>
 48                 <filtering>true</filtering>
 49             </resource>
 50             <resource>
 51                 <directory>src/main/java</directory>
 52                 <includes>
 53                     <include>**/*.properties</include>
 54                     <include>**/*.xml</include>
 55                 </includes>
 56                 <filtering>true</filtering>
 57             </resource>
 58         </resources>
 59     </build>
 60 
 61     <properties>
 62         <!-- base setting -->
 63         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 64         <project.build.locales>zh_CN</project.build.locales>
 65         <project.build.jdk>1.8</project.build.jdk>
 66 
 67         <!-- plugin setting -->
 68         <mybatis.generator.generatorConfig.xml>${basedir}/src/test/resources/generatorConfig.xml</mybatis.generator.generatorConfig.xml>
 69         <mybatis.generator.generatorConfig.properties>file:///${basedir}/src/test/resources/generatorConfig.properties</mybatis.generator.generatorConfig.properties>
 70 
 71         <!-- plugin versions -->
 72         <plugin.mybatis.generator>1.3.1</plugin.mybatis.generator>
 73         <plugin.maven-compiler>3.1</plugin.maven-compiler>
 74 
 75         <!-- lib versions -->
 76         <junit.version>4.11</junit.version>
 77         <spring.version>4.1.6.RELEASE</spring.version>
 78         <mybatis.version>3.2.2</mybatis.version>
 79         <mybatis.spring.version>1.2.2</mybatis.spring.version>
 80         <mysql.connector.version>5.1.30</mysql.connector.version>
 81         <postgresql.version>9.1-901.jdbc4</postgresql.version>
 82         <slf4j.version>1.6.6</slf4j.version>
 83         <log4j.version>1.2.12</log4j.version>
 84         <httpclient.version>4.1.2</httpclient.version>
 85         <jackson.version>1.9.13</jackson.version>
 86         <c3p0.version>0.9.1.2</c3p0.version>
 87         <druid.version>1.0.5</druid.version>
 88         <tomcat.jdbc.version>7.0.53</tomcat.jdbc.version>
 89         <jstl.version>1.2</jstl.version>
 90         <google.collections.version>1.0</google.collections.version>
 91         <cglib.version>3.1</cglib.version>
 92         <shiro.version>1.2.3</shiro.version>
 93         <commons.fileupload.version>1.3.1</commons.fileupload.version>
 94         <commons.codec.version>1.9</commons.codec.version>
 95         <commons.net.version>3.3</commons.net.version>
 96         <aspectj.version>1.6.12</aspectj.version>
 97         <netty.version>4.0.18.Final</netty.version>
 98         <hibernate.validator.version>5.1.1.Final</hibernate.validator.version>
 99         <redis.version>2.8.1</redis.version>
100         <fastjson.version>1.2.17</fastjson.version>
101     </properties>
102 
103     <dependencies>
104 
105         <!-- fastjson -->
106         <dependency>
107             <groupId>com.alibaba</groupId>
108             <artifactId>fastjson</artifactId>
109             <version>${fastjson.version}</version>
110         </dependency>
111 
112         <dependency>
113             <groupId>redis.clients</groupId>
114             <artifactId>jedis</artifactId>
115             <version>${redis.version}</version>
116         </dependency>
117 
118         <!-- junit -->
119         <dependency>
120             <groupId>junit</groupId>
121             <artifactId>junit</artifactId>
122             <version>${junit.version}</version>
123         </dependency>
124 
125         <!-- springframe start -->
126         <dependency>
127             <groupId>org.springframework</groupId>
128             <artifactId>spring-core</artifactId>
129             <version>${spring.version}</version>
130         </dependency>
131 
132         <dependency>
133             <groupId>org.springframework</groupId>
134             <artifactId>spring-web</artifactId>
135             <version>${spring.version}</version>
136         </dependency>
137 
138         <dependency>
139             <groupId>org.springframework</groupId>
140             <artifactId>spring-oxm</artifactId>
141             <version>${spring.version}</version>
142         </dependency>
143 
144         <dependency>
145             <groupId>org.springframework</groupId>
146             <artifactId>spring-tx</artifactId>
147             <version>${spring.version}</version>
148         </dependency>
149 
150         <dependency>
151             <groupId>org.springframework</groupId>
152             <artifactId>spring-jdbc</artifactId>
153             <version>${spring.version}</version>
154         </dependency>
155 
156         <dependency>
157             <groupId>org.springframework</groupId>
158             <artifactId>spring-webmvc</artifactId>
159             <version>${spring.version}</version>
160         </dependency>
161 
162         <dependency>
163             <groupId>org.springframework</groupId>
164             <artifactId>spring-aop</artifactId>
165             <version>${spring.version}</version>
166         </dependency>
167 
168         <dependency>
169             <groupId>org.springframework</groupId>
170             <artifactId>spring-context-support</artifactId>
171             <version>${spring.version}</version>
172         </dependency>
173 
174         <dependency>
175             <groupId>org.springframework</groupId>
176             <artifactId>spring-test</artifactId>
177             <version>${spring.version}</version>
178         </dependency>
179         <!-- springframe end -->
180 
181         <!-- mybatis start-->
182         <dependency>
183             <groupId>org.mybatis</groupId>
184             <artifactId>mybatis</artifactId>
185             <version>${mybatis.version}</version>
186         </dependency>
187 
188         <dependency>
189             <groupId>org.mybatis</groupId>
190             <artifactId>mybatis-spring</artifactId>
191             <version>${mybatis.spring.version}</version>
192         </dependency>
193         <!--mybatis end-->
194 
195         <!-- mysql-connector -->
196         <dependency>
197             <groupId>mysql</groupId>
198             <artifactId>mysql-connector-java</artifactId>
199             <version>${mysql.connector.version}</version>
200         </dependency>
201 
202         <!-- DruidDataSource -->
203         <dependency>
204             <groupId>com.alibaba</groupId>
205             <artifactId>druid</artifactId>
206             <version>${druid.version}</version>
207         </dependency>
208 
209 
210         <!-- log start -->
211         <dependency>
212             <groupId>log4j</groupId>
213             <artifactId>log4j</artifactId>
214             <version>${log4j.version}</version>
215         </dependency>
216         <dependency>
217             <groupId>org.slf4j</groupId>
218             <artifactId>slf4j-api</artifactId>
219             <version>${slf4j.version}</version>
220         </dependency>
221         <dependency>
222             <groupId>org.slf4j</groupId>
223             <artifactId>slf4j-log4j12</artifactId>
224             <version>${slf4j.version}</version>
225         </dependency>
226         <!-- log end -->
227 
228         <!-- servlet api -->
229         <dependency>
230             <groupId>javax.servlet</groupId>
231             <artifactId>javax.servlet-api</artifactId>
232             <version>3.0.1</version>
233             <scope>provided</scope>
234         </dependency>
235 
236         <!-- jstl -->
237         <dependency>
238             <groupId>javax.servlet</groupId>
239             <artifactId>jstl</artifactId>
240             <version>${jstl.version}</version>
241         </dependency>
242 
243         <!-- start apache -->
244         <dependency>
245             <groupId>commons-fileupload</groupId>
246             <artifactId>commons-fileupload</artifactId>
247             <version>${commons.fileupload.version}</version>
248         </dependency>
249 
250         <dependency>
251             <groupId>org.apache.httpcomponents</groupId>
252             <artifactId>httpclient</artifactId>
253             <version>${httpclient.version}</version>
254         </dependency>
255 
256         <dependency>
257             <groupId>commons-codec</groupId>
258             <artifactId>commons-codec</artifactId>
259             <version>${commons.codec.version}</version>
260         </dependency>
261 
262         <dependency>
263             <groupId>commons-net</groupId>
264             <artifactId>commons-net</artifactId>
265             <version>${commons.net.version}</version>
266         </dependency>
267 
268         <dependency>
269             <groupId>commons-logging</groupId>
270             <artifactId>commons-logging</artifactId>
271             <version>1.1.3</version>
272         </dependency>
273         <dependency>
274             <groupId>commons-collections</groupId>
275             <artifactId>commons-collections</artifactId>
276             <version>3.2.1</version>
277         </dependency>
278 
279         <!-- end apache -->
280 
281         <!-- google -->
282         <dependency>
283             <groupId>com.google.collections</groupId>
284             <artifactId>google-collections</artifactId>
285             <version>${google.collections.version}</version>
286         </dependency>
287 
288         <!-- cglib -->
289         <dependency>
290             <groupId>cglib</groupId>
291             <artifactId>cglib-nodep</artifactId>
292             <version>${cglib.version}</version>
293         </dependency>
294 
295 
296         <!-- shiro -->
297         <dependency>
298             <groupId>org.apache.shiro</groupId>
299             <artifactId>shiro-spring</artifactId>
300             <version>${shiro.version}</version>
301         </dependency>
302         <dependency>
303             <groupId>org.apache.shiro</groupId>
304             <artifactId>shiro-ehcache</artifactId>
305             <version>${shiro.version}</version>
306         </dependency>
307         <dependency>
308             <groupId>org.apache.shiro</groupId>
309             <artifactId>shiro-core</artifactId>
310             <version>${shiro.version}</version>
311         </dependency>
312         <dependency>
313             <groupId>org.apache.shiro</groupId>
314             <artifactId>shiro-web</artifactId>
315             <version>${shiro.version}</version>
316         </dependency>
317         <dependency>
318             <groupId>org.apache.shiro</groupId>
319             <artifactId>shiro-quartz</artifactId>
320             <version>${shiro.version}</version>
321         </dependency>
322 
323         <!-- aspectjweaver -->
324         <dependency>
325             <groupId>org.aspectj</groupId>
326             <artifactId>aspectjweaver</artifactId>
327             <version>${aspectj.version}</version>
328         </dependency>
329         <dependency>
330             <groupId>org.aspectj</groupId>
331             <artifactId>aspectjrt</artifactId>
332             <version>${aspectj.version}</version>
333         </dependency>
334 
335         <!-- hibernate-validator -->
336         <dependency>
337             <groupId>org.hibernate</groupId>
338             <artifactId>hibernate-validator</artifactId>
339             <version>${hibernate.validator.version}</version>
340         </dependency>
341 
342         <!-- netty -->
343         <dependency>
344             <groupId>io.netty</groupId>
345             <artifactId>netty-all</artifactId>
346             <version>${netty.version}</version>
347         </dependency>
348 
349         <dependency>
350             <groupId>org.mybatis.generator</groupId>
351             <artifactId>mybatis-generator-core</artifactId>
352             <version>1.3.2</version>
353             <type>jar</type>
354             <scope>test</scope>
355         </dependency>
356 
357     </dependencies>
358 
359 </project>
pom.xml

相关文章: