strust2+hibernate+spring 框架搭建 maven spring 集成redid

  1. 创建maven项目

  2. 导入jar包


  3. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  4.   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  5.   <modelVersion>4.0.0</modelVersion>

  6.   <groupId>football_legend</groupId>

  7.   <artifactId>football_legend</artifactId>

  8.   <packaging>war</packaging>

  9.   <version>0.0.1-SNAPSHOT</version>

  10.   <name>football_legend Maven Webapp</name>

  11.   <url>http://maven.apache.org</url>

  12.  <dependencies>

  13.     <dependency>

  14.       <groupId>junit</groupId>

  15.       <artifactId>junit-dep</artifactId>

  16.       <version>4.8.2</version>

  17.       <scope>test</scope>

  18.     </dependency>

  19.     <dependency>

  20. <groupId>org.drools</groupId>

  21. <artifactId>drools-core</artifactId>

  22. <version>6.1.0.Final</version>

  23. </dependency>


  24. <dependency>

  25. <groupId>org.drools</groupId>

  26. <artifactId>drools-compiler</artifactId>

  27. <version>6.1.0.Final</version>

  28. <scope>runtime</scope>

  29. </dependency>


  30. <dependency>

  31. <groupId>org.springframework</groupId>

  32. <artifactId>spring-context</artifactId>

  33. <version>4.1.1.RELEASE</version>

  34. </dependency>


  35. <dependency>

  36. <groupId>org.springframework</groupId>

  37. <artifactId>spring-test</artifactId>

  38. <version>4.1.1.RELEASE</version>

  39. </dependency>


  40. <dependency>

  41. <groupId>org.springframework</groupId>

  42. <artifactId>spring-jdbc</artifactId>

  43. <version>4.1.1.RELEASE</version>

  44. </dependency>


  45. <dependency>

  46. <groupId>org.springframework</groupId>

  47. <artifactId>spring-beans</artifactId>

  48. <version>4.1.1.RELEASE</version>

  49. </dependency>


  50. <dependency>

  51. <groupId>org.springframework</groupId>

  52. <artifactId>spring-core</artifactId>

  53. <version>4.1.1.RELEASE</version>

  54. </dependency>


  55. <dependency>

  56. <groupId>org.springframework</groupId>

  57. <artifactId>spring-orm</artifactId>

  58. <version>4.1.1.RELEASE</version>

  59. </dependency>


  60. <dependency>

  61. <groupId>org.springframework</groupId>

  62. <artifactId>spring-web</artifactId>

  63. <version>4.1.1.RELEASE</version>

  64. </dependency>



  65. <dependency>

  66. <groupId>org.springframework</groupId>

  67. <artifactId>spring-aop</artifactId>

  68. <version>4.1.1.RELEASE</version>

  69. </dependency>


  70. <dependency>

  71. <groupId>org.springframework</groupId>

  72. <artifactId>spring-aspects</artifactId>

  73. <version>4.1.1.RELEASE</version>

  74. </dependency>


  75. <dependency>

  76. <groupId>org.springframework.data</groupId>

  77. <artifactId>spring-data-mongodb</artifactId>

  78. <version>1.6.1.RELEASE</version>

  79. </dependency>


  80. <dependency>

  81. <groupId>org.aspectj</groupId>

  82. <artifactId>aspectjweaver</artifactId>

  83. <version>1.5.4</version>

  84. </dependency>


  85. <dependency>

  86. <groupId>org.apache.struts</groupId>

  87. <artifactId>struts2-core</artifactId>

  88. <version>2.3.16.3</version>

  89. </dependency>


  90. <dependency>

  91. <groupId>org.apache.struts</groupId>

  92. <artifactId>struts2-convention-plugin</artifactId>

  93. <version>2.3.16.3</version>

  94. </dependency>


  95. <dependency>

  96. <groupId>org.hibernate</groupId>

  97. <artifactId>hibernate-core</artifactId>

  98. <version>4.3.6.Final</version>

  99. </dependency>


  100. <!-- for JPA, use hibernate-entitymanager instead of hibernate-core -->

  101. <dependency>

  102. <groupId>org.hibernate</groupId>

  103. <artifactId>hibernate-entitymanager</artifactId>

  104. <version>4.3.6.Final</version>

  105. </dependency>


  106. <!-- optional -->


  107. <dependency>

  108. <groupId>org.hibernate</groupId>

  109. <artifactId>hibernate-envers</artifactId>

  110. <version>4.3.6.Final</version>

  111. </dependency>


  112. <dependency>

  113. <groupId>org.hibernate</groupId>

  114. <artifactId>hibernate-c3p0</artifactId>

  115. <version>4.3.6.Final</version>

  116. </dependency>


  117. <dependency>

  118. <groupId>org.hibernate</groupId>

  119. <artifactId>hibernate-infinispan</artifactId>

  120. <version>4.3.6.Final</version>

  121. </dependency>


  122. <dependency>

  123. <groupId>org.hibernate</groupId>

  124. <artifactId>hibernate-ehcache</artifactId>

  125. <version>4.3.6.Final</version>

  126. </dependency>



  127. <dependency>

  128. <groupId>javax</groupId>

  129. <artifactId>javaee-api</artifactId>

  130. <version>7.0</version>

  131. </dependency>


  132. <dependency>

  133. <groupId>javax.faces</groupId>

  134. <artifactId>javax.faces-api</artifactId>

  135. <version>2.2</version>

  136. </dependency>



  137. <dependency>

  138. <groupId>org.slf4j</groupId>

  139. <artifactId>slf4j-log4j12</artifactId>

  140. <version>1.7.2</version>

  141. </dependency>


  142. <dependency>

  143. <groupId>org.tuckey</groupId>

  144. <artifactId>urlrewritefilter</artifactId>

  145. <version>4.0.4</version>

  146. </dependency>


  147. <!-- <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> 

  148. <version>0.9.2.1</version> </dependency> -->


  149. <dependency>

  150. <groupId>mysql</groupId>

  151. <artifactId>mysql-connector-java</artifactId>

  152. <version>5.1.33</version>

  153. </dependency>


  154. <dependency>

  155. <groupId>redis.clients</groupId>

  156. <artifactId>jedis</artifactId>

  157. <version>2.6.0</version>

  158. <type>jar</type>

  159. </dependency>


  160. <dependency>

  161. <groupId>com.alibaba</groupId>

  162. <artifactId>fastjson</artifactId>

  163. <version>1.1.41</version>

  164. </dependency>


  165. <dependency>

  166. <groupId>commons-codec</groupId>

  167. <artifactId>commons-codec</artifactId>

  168. <version>1.3</version>

  169. </dependency>


  170. <dependency>

  171. <groupId>org.apache.struts</groupId>

  172. <artifactId>struts2-spring-plugin</artifactId>

  173. <version>2.3.16.3</version>

  174. </dependency>


  175. <dependency>

  176. <groupId>org.apache.httpcomponents</groupId>

  177. <artifactId>httpclient</artifactId>

  178. <version>4.3.6</version>

  179. </dependency>


  180. <dependency>

  181. <groupId>net.sf.barcode4j</groupId>

  182. <artifactId>barcode4j</artifactId>

  183. <version>2.0</version>

  184. </dependency>


  185. <dependency>

  186. <groupId>org.apache.poi</groupId>

  187. <artifactId>poi</artifactId>

  188. <version>3.10.1</version>

  189. </dependency>


  190. <dependency>

  191. <groupId>org.apache.poi</groupId>

  192. <artifactId>poi-ooxml</artifactId>

  193. <version>3.10.1</version>

  194. </dependency>


  195. <dependency>

  196. <groupId>org.apache.commons</groupId>

  197. <artifactId>commons-lang3</artifactId>

  198. <version>3.1</version>

  199. </dependency>

  200. <dependency>

  201. <groupId>commons-collections</groupId>

  202. <artifactId>commons-collections</artifactId>

  203. <version>3.2</version>

  204. </dependency>


  205. <dependency>

  206. <groupId>org.quartz-scheduler</groupId>

  207. <artifactId>quartz</artifactId>

  208. <version>2.2.1</version>

  209. </dependency>

  210. <dependency>

  211. <groupId>org.quartz-scheduler</groupId>

  212. <artifactId>quartz-jobs</artifactId>

  213. <version>2.2.1</version>

  214. </dependency>


  215. <!-- mail -->

  216. <dependency>

  217. <groupId>com.ecwid</groupId>

  218. <artifactId>ecwid-mailchimp</artifactId>

  219. <version>2.0.1.0</version>

  220. </dependency>


  221. <dependency>

  222. <groupId>org.apache.activemq</groupId>

  223. <artifactId>activemq-all</artifactId>

  224. <version>5.11.1</version>

  225. </dependency>


  226. <dependency>

  227. <groupId>org.springframework</groupId>

  228. <artifactId>spring-jms</artifactId>

  229. <version>4.1.1.RELEASE</version>

  230. </dependency>


  231. <dependency>

  232. <groupId>com.lowagie</groupId>

  233. <artifactId>itext</artifactId>

  234. <version>4.2.1</version>

  235. </dependency>

  236. </dependencies>


  237.   <build>

  238.     <finalName>football_legend</finalName>

  239.     <plugins>

  240. <plugin>

  241. <groupId>org.apache.maven.plugins</groupId>

  242. <artifactId>maven-compiler-plugin</artifactId>

  243. <version>2.3.2</version>

  244. <configuration>

  245. <source>1.7</source>

  246. <target>1.7</target>

  247. </configuration>

  248. </plugin>



  249. <plugin>

  250. <groupId>org.apache.maven.plugins</groupId>

  251. <artifactId>maven-resources-plugin</artifactId>

  252. <version>2.4.3</version>

  253. <configuration>

  254. <encoding>UTF-8</encoding>

  255. </configuration>

  256. </plugin>

  257. <plugin>

  258. <groupId>org.apache.maven.plugins</groupId>

  259. <artifactId>maven-surefire-plugin</artifactId>

  260. <version>2.18.1</version>

  261. <configuration>

  262. <skip>true</skip>

  263. </configuration>

  264. </plugin>

  265. </plugins>

  266.   </build>

  267.   <profiles>

  268. <profile>

  269. <id>dev</id>

  270.             <activation>

  271.                 <activeByDefault>true</activeByDefault>

  272.             </activation>

  273. <properties>

  274. <runtime.env>src/main/env/dev/</runtime.env>

  275. <project.build.sourceEncoding>

  276. UTF-8

  277. </project.build.sourceEncoding>

  278. </properties>

  279. </profile>

  280. </profiles>

  281. </project>

  282. 3.配置config.properties 和common.properties

  283. #redis.pool.host=192.168.1.193

  284. redis.pool.host=116.31.94.83

  285. redis.pool.port=6379  

  286. #redis.pool.pass=123456    

  287. redis.pool.maxIdle=300   

  288. redis.pool.maxTotal=600

  289. redis.pool.timeBetweenEvictionRunsMillis=30000  

  290. redis.pool.minEvictableIdleTimeMillis=30000 

  291. redis.pool.testOnBorrow=true 

  292. redis.encode=utf-8

  293. redis.expire=604800000

  294. redis.unlock=false


  295. #jdbc.url=jdbc:mysql://192.168.1.193:3306/football_legend?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false

  296. #jdbc.url=jdbc:mysql://127.0.0.1:3306/football_legend?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false

  297. jdbc.url=jdbc:mysql://116.31.94.83:3306/football_legend?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false

  298. jdbc.username=root

  299. #jdbc.password=

  300. jdbc.password=root

  301. jdbc.showsql=true

4.配置spring.xml ,spring-jdbc.xml ,spring-redis.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 

xmlns:context="http://www.springframework.org/schema/context"

xmlns:aop="http://www.springframework.org/schema/aop"

xmlns:task="http://www.springframework.org/schema/task"

xsi:schemaLocation="http://www.springframework.org/schema/beans 

                    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

                    http://www.springframework.org/schema/context

                    http://www.springframework.org/schema/context/spring-context-2.5.xsd

                    http://www.springframework.org/schema/aop    

         http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

         http://www.springframework.org/schema/task

         http://www.springframework.org/schema/task/spring-task-3.0.xsd

                    ">

      <bean id="propertyConfigurer"

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="locations">

<list>

<value>classpath:config.properties</value>

<!-- <value>classpath:mongodb.properties</value>  -->

<value>classpath:common.properties</value>

<!-- <value>classpath:MQ.properties</value>  -->

</list>

</property>

  </bean>

 

<bean class = "com.xcy.football.legend.common.util.SpringContextUtil" id = "springContextUtil" />

<context:component-scan base-package="com.xcy.*"/>

<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/> 

<context:annotation-config/>

    <context:spring-configured/>

                    

                    

 </beans>                   

转载于:https://my.oschina.net/u/1789682/blog/485424

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值