1 项目视图
2 创建
2.1 总目录 空项目
2.1.1 第一步
2.1.2 第二步
2.1.3 第三步 结果
2.2 父工程 e3-parent
2.2.1 第一步
选择File–>New–>Module,进入New Module页面:
2.2.2 第二步
2.2.3 第三步
2.2.4 第四步 指定maven
2.2.5 第五步 指定路径
2.2.6 第六步 修改pom.xml
2.2.7 第七步 删掉main
2.3 父工程 e3-common 继承
2.3.1 第一步
选中父工程,再次file->new->module->next…这次是新建子工程,就要按自己的需要选择模板了,我这里选个web的。
2.3.2 第二步 清除父模块
由于这个是和e3同级,不存在儿子关系
2.3.3 第三步
2.3.4 第四步 修改pom.xml
2.3.5 第五步 删除 webapp
2.3.6 其他:
父工程e3-manager 继承
2.4 子工程e3-manager-pojo
2.4.1 第一步
选中父工程,再次file->new->module->next…这次是新建子工程,就要按自己的需要选择模板了,我这里选个web的。
2.4.2 第二步 添加父模块
2.4.3 第三步
2.4.4 第四步 修改pom.xml
2.4.5 第五步 删除 webapp
2.4.6 其他
子工程类似
类似,改为war,不删除
2.5 E3-magger
唯一区别
3 配置
3.1 基本配置
3.2 Maven服务器
启动tomcat插件:
clean tomcat7:run
3.3 先部署
可能是common-parent和common-utils没有安装到本地仓库,出现的错误是找不到common-utils的jar包,那就需要我们安装一下。
4 文件
4.1 e3-parent
4.1.1 pom.xml
1. <modelVersion>4.0.0</modelVersion>
2. <groupId>cn.e3mall</groupId>
3. <artifactId>e3-parent</artifactId>
4. <packaging>pom</packaging>
5. <version>1.0-SNAPSHOT</version>
6.
7. <name>e3-parent</name>
8. <url>http://maven.apache.org</url>
9.
10. <!-- 集中定义依赖版本号-->
11. <properties>
12. <junit.version>4.12</junit.version>
13. <spring.version>4.2.4.RELEASE</spring.version>
14. <aspectjweaver.version>1.6.8</aspectjweaver.version>
15. <aopalliance.version>1.0</aopalliance.version>
16. <mybatis.version>3.2.8</mybatis.version>
17. <mybatis.spring.version>1.2.2</mybatis.spring.version>
18. <mybatis.paginator.version>1.2.15</mybatis.paginator.version>
19. <mysql.version>5.1.32</mysql.version>
20. <slf4j.version>1.6.4</slf4j.version>
21. <jackson.version>2.4.2</jackson.version>
22. <fastjson.version>1.2.38</fastjson.version>
23. <druid.version>1.0.9</druid.version>
24. <httpclient.version>4.3.5</httpclient.version>
25. <jstl.version>1.2</jstl.version>
26. <servlet-api.version>2.5</servlet-api.version>
27. <jsp-api.version>2.0</jsp-api.version>
28. <joda-time.version>2.5</joda-time.version>
29. <commons-lang3.version>3.3.2</commons-lang3.version>
30. <commons-io.version>1.3.2</commons-io.version>
31. <commons-net.version>3.3</commons-net.version>
32. <pagehelper.version>5.0.0</pagehelper.version>
33. <jsqlparser.version>0.9.1</jsqlparser.version>
34. <commons-fileupload.version>1.3.1</commons-fileupload.version>
35. <jedis.version>2.7.2</jedis.version>
36. <solrj.version>4.10.3</solrj.version>
37. <dubbo.version>2.5.3</dubbo.version>
38. <zookeeper.version>3.4.7</zookeeper.version>
39. <zkclient.version>0.1</zkclient.version>
40. <activemq.version>5.11.2</activemq.version>
41. <freemarker.version>2.3.23</freemarker.version>
42. <quartz.version>2.2.2</quartz.version>
43. </properties>
44.
45. <dependencyManagement>
46. <dependencies>
47. <!-- 时间操作组件 -->
48. <dependency>
49. <groupId>joda-time</groupId>
50. <artifactId>joda-time</artifactId>
51. <version>${joda-time.version}</version>
52. </dependency>
53. <!-- Apache工具组件 -->
54. <dependency>
55. <groupId>org.apache.commons</groupId>
56. <artifactId>commons-lang3</artifactId>
57. <version>${commons-lang3.version}</version>
58. </dependency>
59. <dependency>
60. <groupId>org.apache.commons</groupId>
61. <artifactId>commons-io</artifactId>
62. <version>${commons-io.version}</version>
63. </dependency>
64. <dependency>
65. <groupId>commons-net</groupId>
66. <artifactId>commons-net</artifactId>
67. <version>${commons-net.version}</version>
68. </dependency>
69. <!-- Jackson Json处理工具包 -->
70. <dependency>
71. <groupId>com.fasterxml.jackson.core</groupId>
72. <artifactId>jackson-databind</artifactId>
73. <version>${jackson.version}</version>
74. </dependency>
75. <!-- https://mvnrepository.com/artifact/com.alibaba/fastjson
76. 支持JSONObject-->
77. <dependency>
78. <groupId>com.alibaba</groupId>
79. <artifactId>fastjson</artifactId>
80. <version>${fastjson.version}</version>
81. </dependency>
82.
83. <!-- httpclient -->
84. <dependency>
85. <groupId>org.apache.httpcomponents</groupId>
86. <artifactId>httpclient</artifactId>
87. <version>${httpclient.version}</version>
88. </dependency>
89. <!-- quartz任务调度框架 -->
90. <dependency>
91. <groupId>org.quartz-scheduler</groupId>
92. <artifactId>quartz</artifactId>
93. <version>${quartz.version}</version>
94. </dependency>
95. <!-- 单元测试 -->
96. <dependency>
97. <groupId>junit</groupId>
98. <artifactId>junit</artifactId>
99. <version>${junit.version}</version>
100. <scope>test</scope>
101. </dependency>
102. <!-- 日志处理 -->
103. <dependency>
104. <groupId>org.slf4j</groupId>
105. <artifactId>slf4j-log4j12</artifactId>
106. <version>${slf4j.version}</version>
107. </dependency>
108.
109. <!-- Mybatis -->
110. <dependency>
111. <groupId>org.mybatis</groupId>
112. <artifactId>mybatis</artifactId>
113. <version>${mybatis.version}</version>
114. </dependency>
115. <dependency>
116. <groupId>org.mybatis</groupId>
117. <artifactId>mybatis-spring</artifactId>
118. <version>${mybatis.spring.version}</version>
119. </dependency>
120. <dependency>
121. <groupId>com.github.miemiedev</groupId>
122. <artifactId>mybatis-paginator</artifactId>
123. <version>${mybatis.paginator.version}</version>
124. </dependency>
125. <dependency>
126. <groupId>com.github.pagehelper</groupId>
127. <artifactId>pagehelper</artifactId>
128. <version>${pagehelper.version}</version>
129. </dependency>
130. <!-- MySql -->
131. <dependency>
132. <groupId>mysql</groupId>
133. <artifactId>mysql-connector-java</artifactId>
134. <version>${mysql.version}</version>
135. </dependency>
136. <!-- 连接池 -->
137. <dependency>
138. <groupId>com.alibaba</groupId>
139. <artifactId>druid</artifactId>
140. <version>${druid.version}</version>
141. </dependency>
142. <!-- Spring -->
143. <!-- Spring Core -->
144. <dependency>
145. <groupId>org.springframework</groupId>
146. <artifactId>spring-core</artifactId>
147. <version>${spring.version}</version>
148. </dependency>
149. <dependency>
150. <groupId>org.springframework</groupId>
151. <artifactId>spring-beans</artifactId>
152. <version>${spring.version}</version>
153. </dependency>
154. <dependency>
155. <groupId>org.springframework</groupId>
156. <artifactId>spring-context</artifactId>
157. <version>${spring.version}</version>
158. </dependency>
159. <dependency>
160. <groupId>org.springframework</groupId>
161. <artifactId>spring-context-support</artifactId>
162. <version>${spring.version}</version>
163. </dependency>
164.
165. <!--Spring Dao -->
166. <dependency>
167. <groupId>org.springframework</groupId>
168. <artifactId>spring-jdbc</artifactId>
169. <version>${spring.version}</version>
170. </dependency>
171. <dependency>
172. <groupId>org.springframework</groupId>
173. <artifactId>spring-tx</artifactId>
174. <version>${spring.version}</version>
175. </dependency>
176. <dependency>
177. <groupId>org.springframework</groupId>
178. <artifactId>spring-aspects</artifactId>
179. <version>${spring.version}</version>
180. </dependency>
181. <dependency>
182. <groupId>org.springframework</groupId>
183. <artifactId>spring-jms</artifactId>
184. <version>${spring.version}</version>
185. </dependency>
186.
187. <!-- Spring Web -->
188. <dependency>
189. <groupId>org.springframework</groupId>
190. <artifactId>spring-web</artifactId>
191. <version>${spring.version}</version>
192. </dependency>
193. <dependency>
194. <groupId>org.springframework</groupId>
195. <artifactId>spring-webmvc</artifactId>
196. <version>${spring.version}</version>
197. </dependency>
198.
199. <!-- Spring test -->
200. <dependency>
201. <groupId>org.springframework</groupId>
202. <artifactId>spring-test</artifactId>
203. <version>${spring.version}</version>
204. </dependency>
205.
206. <dependency>
207. <groupId>org.aspectj</groupId>
208. <artifactId>aspectjweaver</artifactId>
209. <version>${aspectjweaver.version}</version>
210. </dependency>
211.
212. <dependency>
213. <groupId>aopalliance</groupId>
214. <artifactId>aopalliance</artifactId>
215. <version>${aopalliance.version}</version>
216. </dependency>
217.
218. <!-- JSP相关 -->
219. <dependency>
220. <groupId>jstl</groupId>
221. <artifactId>jstl</artifactId>
222. <version>${jstl.version}</version>
223. </dependency>
224. <dependency>
225. <groupId>javax.servlet</groupId>
226. <artifactId>servlet-api</artifactId>
227. <version>${servlet-api.version}</version>
228. <scope>provided</scope>
229. </dependency>
230. <dependency>
231. <groupId>javax.servlet</groupId>
232. <artifactId>jsp-api</artifactId>
233. <version>${jsp-api.version}</version>
234. <scope>provided</scope>
235. </dependency>
236. <!-- 文件上传组件 -->
237. <dependency>
238. <groupId>commons-fileupload</groupId>
239. <artifactId>commons-fileupload</artifactId>
240. <version>${commons-fileupload.version}</version>
241. </dependency>
242. <!-- Redis客户端 -->
243. <dependency>
244. <groupId>redis.clients</groupId>
245. <artifactId>jedis</artifactId>
246. <version>${jedis.version}</version>
247. </dependency>
248. <!-- solr客户端 -->
249. <dependency>
250. <groupId>org.apache.solr</groupId>
251. <artifactId>solr-solrj</artifactId>
252. <version>${solrj.version}</version>
253. </dependency>
254. <!-- dubbo相关 -->
255. <dependency>
256. <groupId>com.alibaba</groupId>
257. <artifactId>dubbo</artifactId>
258. <version>${dubbo.version}</version>
259. </dependency>
260. <dependency>
261. <groupId>org.apache.zookeeper</groupId>
262. <artifactId>zookeeper</artifactId>
263. <version>${zookeeper.version}</version>
264. </dependency>
265. <dependency>
266. <groupId>com.github.sgroschupf</groupId>
267. <artifactId>zkclient</artifactId>
268. <version>${zkclient.version}</version>
269. </dependency>
270. <dependency>
271. <groupId>org.apache.activemq</groupId>
272. <artifactId>activemq-all</artifactId>
273. <version>${activemq.version}</version>
274. </dependency>
275. <dependency>
276. <groupId>org.freemarker</groupId>
277. <artifactId>freemarker</artifactId>
278. <version>${freemarker.version}</version>
279. </dependency>
280.
281. </dependencies>
282. </dependencyManagement>
283.
284. <build>
285. <finalName>${project.artifactId}</finalName>
286. <plugins>
287. <!-- 资源文件拷贝插件-->
288. <plugin>
289. <groupId>org.apache.maven.plugins</groupId>
290. <artifactId>maven-resources-plugin</artifactId>
291. <version>2.7</version>
292. <configuration>
293. <encoding>UTF-8</encoding>
294. </configuration>
295. </plugin>
296. <!-- java编译插件 -->
297. <plugin>
298. <groupId>org.apache.maven.plugins</groupId>
299. <artifactId>maven-compiler-plugin</artifactId>
300. <version>3.2</version>
301. <configuration>
302. <source>1.7</source>
303. <target>1.7</target>
304. <encoding>UTF-8</encoding>
305. </configuration>
306. </plugin>
307. </plugins>
308.
309. <pluginManagement>
310. <plugins>
311. <!-- 配置Tomcat插件 -->
312. <plugin>
313. <groupId>org.apache.tomcat.maven</groupId>
314. <artifactId>tomcat7-maven-plugin</artifactId>
315. <version>2.2</version>
316. </plugin>
317. </plugins>
318. </pluginManagement>
319. </build>
4.2 e3-common
4.2.1 pom.xml
1. <parent>
2. <artifactId>e3-parent</artifactId>
3. <groupId>cn.e3mall</groupId>
4. <version>1.0-SNAPSHOT</version>
5. <relativePath>../e3-parent/pom.xml</relativePath>
6. </parent>
7. <modelVersion>4.0.0</modelVersion>
8. <artifactId>e3-common</artifactId>
9. <packaging>jar</packaging>
10. <name>e3-common</name>
11. <url>http://maven.apache.org</url>
12.
13. <dependencies>
14. <!-- 时间操作组件 -->
15. <dependency>
16. <groupId>joda-time</groupId>
17. <artifactId>joda-time</artifactId>
18. </dependency>
19. <!-- Apache工具组件 -->
20. <dependency>
21. <groupId>org.apache.commons</groupId>
22. <artifactId>commons-lang3</artifactId>
23. </dependency>
24. <dependency>
25. <groupId>org.apache.commons</groupId>
26. <artifactId>commons-io</artifactId>
27. </dependency>
28. <dependency>
29. <groupId>commons-net</groupId>
30. <artifactId>commons-net</artifactId>
31. </dependency>
32. <!-- Jackson Json处理工具包 支持jsonObject-->
33. <dependency>
34. <groupId>com.fasterxml.jackson.core</groupId>
35. <artifactId>jackson-databind</artifactId>
36. </dependency>
37. <dependency>
38. <groupId>com.alibaba</groupId>
39. <artifactId>fastjson</artifactId>
40. </dependency>
41.
42. <!-- httpclient -->
43. <dependency>
44. <groupId>org.apache.httpcomponents</groupId>
45. <artifactId>httpclient</artifactId>
46. </dependency>
47. <!-- quartz任务调度框架 -->
48. <dependency>
49. <groupId>org.quartz-scheduler</groupId>
50. <artifactId>quartz</artifactId>
51. </dependency>
52. <!-- 单元测试 -->
53. <dependency>
54. <groupId>junit</groupId>
55. <artifactId>junit</artifactId>
56. <scope>test</scope>
57. </dependency>
58. <!-- 日志处理 -->
59. <dependency>
60. <groupId>org.slf4j</groupId>
61. <artifactId>slf4j-log4j12</artifactId>
62. </dependency>
63.
64.
65.
66. </dependencies>
67.
68. <build>
69. <finalName>${project.artifactId}</finalName>
70. </build>
4.3 e3-manager
4.3.1 pom.xml
1. <parent>
2. <artifactId>e3-parent</artifactId>
3. <groupId>cn.e3mall</groupId>
4. <version>1.0-SNAPSHOT</version>
5. <relativePath>../e3-parent/pom.xml</relativePath>
6. </parent>
7.
8. <modelVersion>4.0.0</modelVersion>
9. <artifactId>e3-manager</artifactId>
10. <packaging>pom</packaging>
11. <name>e3-manager</name>
12. <url>http://maven.apache.org</url>
13.
14. <modules>
15. <module>e3-manager-pojo</module>
16. <module>e3-manager-dao</module>
17. <module>e3-manager-interface</module>
18. <module>e3-manager-service</module>
19. <module>e3-manager-web</module>
20. </modules>
21.
22. <dependencies>
23. <dependency>
24. <groupId>cn.e3mall</groupId>
25. <artifactId>e3-common</artifactId>
26. <version>1.0-SNAPSHOT</version>
27. </dependency>
28. </dependencies>
29.
30. <!-- 配置tomcat插件 -->
31. <build>
32. <finalName>${project.artifactId}</finalName>
33. <plugins>
34. <plugin>
35. <groupId>org.apache.tomcat.maven</groupId>
36. <artifactId>tomcat7-maven-plugin</artifactId>
37. <configuration>
38. <path>/</path>
39. <port>8080</port>
40. </configuration>
41. </plugin>
42. </plugins>
43. </build>
4.4 e3-manager-web
4.4.1 pom.xml
1. <parent>
2. <artifactId>e3-manager</artifactId>
3. <groupId>cn.e3mall</groupId>
4. <version>1.0-SNAPSHOT</version>
5. </parent>
6. <modelVersion>4.0.0</modelVersion>
7. <artifactId>e3-manager-web</artifactId>
8. <packaging>war</packaging>
9. <name>e3-manager-web Maven Webapp</name>
10. <url>http://maven.apache.org</url>
11.
12. <dependencies>
13. <dependency>
14. <groupId>cn.e3mall</groupId>
15. <artifactId>e3-manager-service</artifactId>
16. <version>1.0-SNAPSHOT</version>
17. </dependency>
18.
19. <!-- JSP相关 -->
20. <dependency>
21. <groupId>jstl</groupId>
22. <artifactId>jstl</artifactId>
23. </dependency>
24. <dependency>
25. <groupId>javax.servlet</groupId>
26. <artifactId>servlet-api</artifactId>
27. <scope>provided</scope>
28. </dependency>
29. <dependency>
30. <groupId>javax.servlet</groupId>
31. <artifactId>jsp-api</artifactId>
32. <scope>provided</scope>
33. </dependency>
34. </dependencies>
35.
36. <build>
37. <finalName>${project.artifactId}</finalName>
38. </build>
4.4.2 db.properties
1. jdbc.driverClassName=com.mysql.jdbc.Driver
2. jdbc.url=jdbc:mysql://localhost:3306/e3mall-32?characterEncoding=utf-8
3. jdbc.username=root
4. jdbc.password=root
4.4.3 applicationContext-dao
1. <?xml version="1.0"encoding="UTF-8"?>
2. <beansxmlnsbeansxmlns="http://www.springframework.org/schema/beans"
3. xmlns:context="http://www.springframework.org/schema/context"xmlns:p="http://www.springframework.org/schema/p"
4. xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"
5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6. xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.2.xsd
7. http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.2.xsd
8. http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-4.2.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-4.2.xsd
9. http://www.springframework.org/schema/utilhttp://www.springframework.org/schema/util/spring-util-4.2.xsd">
10.
11.
12. <!--2.数据源 -->
13. <!--2.1 引入-->
14. <context:property-placeholderlocationcontext:property-placeholderlocation="classpath*:db.properties" />
15.
16. <!--2.2 加载 -->
17. <beanidbeanid="dataSource"class="com.alibaba.druid.pool.DruidDataSource">
18. <propertynamepropertyname="url" value="${jdbc.url}"></property>
19. <propertynamepropertyname="driverClassName"value="${jdbc.driverClassName}"></property>
20. <propertynamepropertyname="username"value="${jdbc.username}"></property>
21. <propertynamepropertyname="password" value="${jdbc.password}"></property>
22.
23. <propertynamepropertyname="maxActive" value="10" />
24. <propertynamepropertyname="minIdle" value="5" />
25. </bean>
26.
27. <!--3.sqlSessionFactory 配置和MyBatis的整合 -->
28. <beanidbeanid="sqlSessionFactory"class="org.mybatis.spring.SqlSessionFactoryBean">
29. <!--3.1注入数据源 -->
30. <propertynamepropertyname="dataSource" ref="dataSource"></property>
31.
32. <!--3.2 指定mybatis 全局配置文件 -->
33. <propertynamepropertyname="configLocation"value="classpath:./mybatis/SqlMapConfig.xml"/>
34.
35. <!--3.3指定mybatis,mapper文件的位置 -->
36. <!--<propertyname="mapperLocations" value="classpath:mapper/*.xml"></property>-->
37. </bean>
38.
39. <!--4. 配置mybatis扫描器, -->
40. <!--4.1 将mybatis接口的实现加入到ioc容器中 dao接口 -->
41. <beanclassbeanclass="org.mybatis.spring.mapper.MapperScannerConfigurer">
42. <propertynamepropertyname="basePackage"value="cn.e3mall.mapper"></property>
43. <!--使用sqlSessionFactoryBeanName-->
44. <propertynamepropertyname="sqlSessionFactoryBeanName"value="sqlSessionFactory"/>
45. </bean>
46.
47. <!--4.2 (可选)配置一个可以执行批量的sqlSession-->
48. <beanidbeanid="sqlSession"class="org.mybatis.spring.SqlSessionTemplate">
49. <constructor-argnameconstructor-argname="sqlSessionFactory"ref="sqlSessionFactory"></constructor-arg>
50. <constructor-argnameconstructor-argname="executorType"value="BATCH"></constructor-arg>
51. </bean>
52.
53. </beans>
4.4.4 applicationContext-service
1. <?xml version="1.0"encoding="UTF-8"?>
2. <beans xmlns="http://www.springframework.org/schema/beans"
3. xmlns:context="http://www.springframework.org/schema/context"xmlns:p="http://www.springframework.org/schema/p"
4. xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"
5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6. xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.2.xsd
7. http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.2.xsd
8. http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-4.2.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx-4.2.xsd
9. http://www.springframework.org/schema/utilhttp://www.springframework.org/schema/util/spring-util-4.2.xsd">
10.
11. <!--配置包扫描器 -->
12. <context:component-scanbase-packagecontext:component-scanbase-package="cn.e3mall.service"/>
13.
14. </beans>
4.4.5 applicationContext-trans
1. <?xml version="1.0" encoding="UTF-8"?>
2. <beansxmlnsbeansxmlns="http://www.springframework.org/schema/beans"
3. xmlns:context="http://www.springframework.org/schema/context"xmlns:p="http://www.springframework.org/schema/p"
4. xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"
5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6. xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.2.xsd
7. http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.2.xsd
8. http://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-4.2.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
9. http://www.springframework.org/schema/utilhttp://www.springframework.org/schema/util/spring-util-4.2.xsd">
10.
11. <!--事务管理器 -->
12. <beanidbeanid="transactionManager"
13. class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
14. <!--数据源 -->
15. <propertynamepropertyname="dataSource" ref="dataSource" />
16. </bean>
17.
18. <!--通知 -->
19. <tx:adviceidtx:adviceid="txAdvice" transaction-manager="transactionManager">
20. <tx:attributes>
21. <!--传播行为 -->
22. <tx:methodnametx:methodname="save*" propagation="REQUIRED" />
23. <tx:methodnametx:methodname="insert*" propagation="REQUIRED" />
24. <tx:methodnametx:methodname="add*" propagation="REQUIRED" />
25. <tx:methodnametx:methodname="create*" propagation="REQUIRED" />
26. <tx:methodnametx:methodname="delete*" propagation="REQUIRED" />
27. <tx:methodnametx:methodname="update*" propagation="REQUIRED" />
28. <tx:methodnametx:methodname="find*" propagation="SUPPORTS"read-only="true" />
29. <tx:methodnametx:methodname="select*" propagation="SUPPORTS"read-only="true" />
30. <tx:methodnametx:methodname="get*" propagation="SUPPORTS"read-only="true" />
31. </tx:attributes>
32. </tx:advice>
33.
34. <!--切面 -->
35. <aop:config>
36. <aop:advisoradvice-refaop:advisoradvice-ref="txAdvice"
37. pointcut="execution(*cn.e3mall.service..*.*(..))" />
38. </aop:config>
39. </beans>
4.4.6 springmvc
1. <?xml version="1.0" encoding="UTF-8"?>
2. <beansxmlnsbeansxmlns="http://www.springframework.org/schema/beans"
3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:p="http://www.springframework.org/schema/p"
4. xmlns:context="http://www.springframework.org/schema/context"
5. xmlns:mvc="http://www.springframework.org/schema/mvc"
6. xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.2.xsd
7. http://www.springframework.org/schema/mvchttp://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
8. http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.2.xsd">
9.
10. <!--1. 扫描 -->
11. <context:component-scanbase-packagecontext:component-scanbase-package="cn.e3mall.controller" />
12.
13. <!--2.两个标准配置 -->
14. <!--将springmvc不能处理的请求交给tomcat -->
15. <mvc:default-servlet-handler/>
16. <!--能支持springmvc更高级的一些功能,JSR303校验,快捷的ajax...映射动态请求 -->
17. <mvc:annotation-driven/>
18.
19. <!--3.配置视图解析器,方便页面返回-->
20. <bean
21. class="org.springframework.web.servlet.view.InternalResourceViewResolver">
22. <propertynamepropertyname="prefix" value="/WEB-INF/jsp/" />
23. <propertynamepropertyname="suffix" value=".jsp" />
24. </bean>
25. </beans>
4.4.7 SqlMapConfig
1. <?xml version="1.0"encoding="UTF-8" ?>
2. <!DOCTYPE configuration
3. PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
4. "http://mybatis.org/dtd/mybatis-3-config.dtd">
5. <configuration>
6.
7. <!-- 1.驮峰式命名规则 -->
8. <settings>
9. <setting name="mapUnderscoreToCamelCase"value="true" />
10. </settings>
11.
12. <!-- 2.ognl实例类的别名 -->
13. <typeAliases>
14. <package name="cn.e3mall.pojo" />
15. </typeAliases>
16.
17. <!-- 3.(扩展)注册分页插件-->
18. <plugins>
19. <plugininterceptorplugininterceptor="com.github.pagehelper.PageInterceptor"></plugin>
20. </plugins>
21.
22. </configuration>
4.4.8 web.xml
1. <?xml version="1.0"encoding="UTF-8"?>
2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3. xmlns="http://java.sun.com/xml/ns/javaee"
4. xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
5. version="2.5">
6. <display-name>e3-manager-web</display-name>
7.
8. <!--1.Spring容器applicationContext.xml -->
9. <context-param>
10. <param-name>contextConfigLocation</param-name>
11. <param-value>classpath*:spring/applicationContext-*.xml</param-value>
12. </context-param>
13.
14. <listener>
15. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
16. </listener>
17.
18. <!--2.springmvc的前端控制器e3-manager -->
19. <servlet>
20. <servlet-name>springDispatcherServlet</servlet-name>
21. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
22. <!--contextConfigLocation不是必须的,
23. 如果不配置contextConfigLocation, springmvc的配置文件默认在:WEB-INF/servlet的name+"-servlet.xml"-->
24. <init-param>
25. <param-name>contextConfigLocation</param-name>
26. <param-value>classpath:spring/springmvc.xml</param-value>
27. </init-param>
28. <load-on-startup>1</load-on-startup>
29. </servlet>
30. <servlet-mapping>
31. <servlet-name>springDispatcherServlet</servlet-name>
32. <url-pattern>/</url-pattern>
33. </servlet-mapping>
34.
35. <!--3.编码过滤 解决post乱码 -->
36. <filter>
37. <filter-name>CharacterEncodingFilter</filter-name>
38. <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
39. <init-param>
40. <param-name>encoding</param-name>
41. <param-value>utf-8</param-value>
42. </init-param>
43. </filter>
44. <filter-mapping>
45. <filter-name>CharacterEncodingFilter</filter-name>
46. <url-pattern>/*</url-pattern>
47. </filter-mapping>
48.
49. <!--4、使用Rest风格的URI,将页面普通的post请求转为指定的delete或者put请求 -->
50. <filter>
51. <filter-name>HiddenHttpMethodFilter</filter-name>
52. <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
53. </filter>
54. <filter-mapping>
55. <filter-name>HiddenHttpMethodFilter</filter-name>
56. <url-pattern>/*</url-pattern>
57. </filter-mapping>
58. <filter>
59. <filter-name>HttpPutFormContentFilter</filter-name>
60. <filter-class>org.springframework.web.filter.HttpPutFormContentFilter</filter-class>
61. </filter>
62. <filter-mapping>
63. <filter-name>HttpPutFormContentFilter</filter-name>
64. <url-pattern>/*</url-pattern>
65. </filter-mapping>
66.
67. <welcome-file-list>
68. <welcome-file>index.html</welcome-file>
69. <welcome-file>index.htm</welcome-file>
70. <welcome-file>index.jsp</welcome-file>
71. <welcome-file>default.html</welcome-file>
72. <welcome-file>default.htm</welcome-file>
73. <welcome-file>default.jsp</welcome-file>
74. </welcome-file-list>
75. </web-app>
4.5 e3-manager-service
4.5.1 pom.xml
1. <projectxmlnsprojectxmlns="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.0http://maven.apache.org/maven-v4_0_0.xsd">
3. <parent>
4. <artifactId>e3-manager</artifactId>
5. <groupId>cn.e3mall</groupId>
6. <version>1.0-SNAPSHOT</version>
7. </parent>
8. <modelVersion>4.0.0</modelVersion>
9. <artifactId>e3-manager-service</artifactId>
10. <packaging>jar</packaging>
11. <name>e3-manager-service</name>
12. <url>http://maven.apache.org</url>
13.
14. <dependencies>
15. <dependency>
16. <groupId>cn.e3mall</groupId>
17. <artifactId>e3-manager-dao</artifactId>
18. <version>1.0-SNAPSHOT</version>
19. </dependency>
20. <dependency>
21. <groupId>cn.e3mall</groupId>
22. <artifactId>e3-manager-interface</artifactId>
23. <version>1.0-SNAPSHOT</version>
24. </dependency>
25. <!-- spring的依赖 -->
26. <!-- Spring -->
27. <dependency>
28. <groupId>org.springframework</groupId>
29. <artifactId>spring-core</artifactId>
30. </dependency>
31. <dependency>
32. <groupId>org.springframework</groupId>
33. <artifactId>spring-beans</artifactId>
34. </dependency>
35. <dependency>
36. <groupId>org.springframework</groupId>
37. <artifactId>spring-context</artifactId>
38. </dependency>
39. <dependency>
40. <groupId>org.springframework</groupId>
41. <artifactId>spring-context-support</artifactId>
42. </dependency>
43.
44. <!--Spring Dao -->
45. <dependency>
46. <groupId>org.springframework</groupId>
47. <artifactId>spring-jdbc</artifactId>
48. </dependency>
49. <dependency>
50. <groupId>org.springframework</groupId>
51. <artifactId>spring-tx</artifactId>
52. </dependency>
53. <dependency>
54. <groupId>org.springframework</groupId>
55. <artifactId>spring-aspects</artifactId>
56. </dependency>
57. <dependency>
58. <groupId>org.springframework</groupId>
59. <artifactId>spring-jms</artifactId>
60. </dependency>
61.
62. <!-- Spring Web -->
63. <dependency>
64. <groupId>org.springframework</groupId>
65. <artifactId>spring-web</artifactId>
66. </dependency>
67. <dependency>
68. <groupId>org.springframework</groupId>
69. <artifactId>spring-webmvc</artifactId>
70. </dependency>
71.
72. <!-- Spring test -->
73. <dependency>
74. <groupId>org.springframework</groupId>
75. <artifactId>spring-test</artifactId>
76. </dependency>
77.
78. <dependency>
79. <groupId>org.aspectj</groupId>
80. <artifactId>aspectjweaver</artifactId>
81. </dependency>
82.
83. <dependency>
84. <groupId>aopalliance</groupId>
85. <artifactId>aopalliance</artifactId>
86. </dependency>
87.
88. </dependencies>
89.
90. <build>
91. <finalName>${project.artifactId}</finalName>
92. </build>
93. </project>
4.6 e3-manager-interface
4.6.1 pom.xml
1. <projectxmlnsprojectxmlns="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.0http://maven.apache.org/maven-v4_0_0.xsd">
3. <parent>
4. <artifactId>e3-manager</artifactId>
5. <groupId>cn.e3mall</groupId>
6. <version>1.0-SNAPSHOT</version>
7. </parent>
8.
9. <modelVersion>4.0.0</modelVersion>
10. <artifactId>e3-manager-interface</artifactId>
11. <packaging>jar</packaging>
12. <name>e3-manager-interface</name>
13. <url>http://maven.apache.org</url>
14.
15. <dependencies>
16. <dependency>
17. <groupId>cn.e3mall</groupId>
18. <artifactId>e3-manager-pojo</artifactId>
19. <version>1.0-SNAPSHOT</version>
20. </dependency>
21. </dependencies>
22.
23.
24. <build>
25. <finalName>${project.artifactId}</finalName>
26. </build>
27. </project>
4.7 e3-manager-dao
4.7.1 pom.xml
1. <projectxmlnsprojectxmlns="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.0http://maven.apache.org/maven-v4_0_0.xsd">
3. <parent>
4. <artifactId>e3-manager</artifactId>
5. <groupId>cn.e3mall</groupId>
6. <version>1.0-SNAPSHOT</version>
7. </parent>
8.
9. <modelVersion>4.0.0</modelVersion>
10. <artifactId>e3-manager-dao</artifactId>
11. <packaging>jar</packaging>
12. <name>e3-manager-dao</name>
13. <url>http://maven.apache.org</url>
14.
15. <dependencies>
16. <dependency>
17. <groupId>cn.e3mall</groupId>
18. <artifactId>e3-manager-pojo</artifactId>
19. <version>1.0-SNAPSHOT</version>
20. </dependency>
21.
22. <!-- 添加对mybatis的依赖 -->
23. <dependency>
24. <groupId>org.mybatis</groupId>
25. <artifactId>mybatis</artifactId>
26. </dependency>
27. <dependency>
28. <groupId>org.mybatis</groupId>
29. <artifactId>mybatis-spring</artifactId>
30. </dependency>
31. <dependency>
32. <groupId>com.github.miemiedev</groupId>
33. <artifactId>mybatis-paginator</artifactId>
34. </dependency>
35. <dependency>
36. <groupId>com.github.pagehelper</groupId>
37. <artifactId>pagehelper</artifactId>
38. </dependency>
39.
40. <!-- MySql -->
41. <dependency>
42. <groupId>mysql</groupId>
43. <artifactId>mysql-connector-java</artifactId>
44. </dependency>
45. <!-- 连接池 -->
46. <dependency>
47. <groupId>com.alibaba</groupId>
48. <artifactId>druid</artifactId>
49. </dependency>
50. <dependency>
51. <groupId>junit</groupId>
52. <artifactId>junit</artifactId>
53. <scope>test</scope>
54. </dependency>
55. <dependency>
56. <groupId>org.springframework</groupId>
57. <artifactId>spring-test</artifactId>
58. <version>4.3.7.RELEASE</version>
59. <scope>test</scope>
60. </dependency>
61. <dependency>
62. <groupId>org.springframework</groupId>
63. <artifactId>spring-beans</artifactId>
64. <scope>test</scope>
65. </dependency>
66. <dependency>
67. <groupId>org.springframework</groupId>
68. <artifactId>spring-oxm</artifactId>
69. <version>4.3.7.RELEASE</version>
70. </dependency>
71. </dependencies>
72.
73. <build>
74. <finalName>${project.artifactId}</finalName>
75. <resources>
76. <resource>
77. <directory>src/main/java</directory>
78. <includes>
79. <include>**/*.properties</include>
80. <include>**/*.xml</include>
81. </includes>
82. <filtering>false</filtering>
83. </resource>
84. </resources>
85. </build>
86. </project>
4.8 e3-manager-pojo
4.8.1 pom.xml
1. <projectxmlnsprojectxmlns="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.0http://maven.apache.org/maven-v4_0_0.xsd">
3. <parent>
4. <artifactId>e3-manager</artifactId>
5. <groupId>cn.e3mall</groupId>
6. <version>1.0-SNAPSHOT</version>
7. </parent>
8. <modelVersion>4.0.0</modelVersion>
9. <artifactId>e3-manager-pojo</artifactId>
10. <packaging>jar</packaging>
11. <name>e3-manager-pojo</name>
12. <url>http://maven.apache.org</url>
13.
14. <build>
15. <finalName>${project.artifactId}</finalName>
16. </build>
17. </project>