文档章节

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

你不懂我的夜
 你不懂我的夜
发布于 2015/07/30 09:20
字数 895
阅读 21
收藏 0
  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>                   

© 著作权归作者所有

共有 人打赏支持
你不懂我的夜
粉丝 0
博文 10
码字总数 5460
作品 0
深圳
架构师
私信 提问
简化SSM搭建详细分析配置

一直使用SSH2 和 spring boot,最近换工作,使用新框架SpringMVC,带着SSH2的思路学习SpringMVC还是挺容易的,下面分享一下SSM的搭建 总体来说搭建SSM分五步 一:创建maven工程 这里是创建m...

红尾巴的猪
2017/11/10
0
0
Maven搭建SpringMVC+Hibernate项目详解 【转】

今天复习一下SpringMVC+Hibernate的搭建,本来想着将Spring-Security权限控制框架也映入其中的,但是发现内容太多了,Spring-Security的就留在下一篇吧,这篇主要搭建SpringMVC4.1.4和Hiber...

梵蒂冈考虑过
2016/10/19
37
1
Maven搭建SpringMVC+Hibernate项目详解 【转】

。搭建SpringMVC+Hibernate的框架的思路如下: 1、设计数据库:设计好表结构,最好符合3NF,采用Hibernate tools将设计好的表自动生成对应的实体entity。 1、创建Maven项目,按需映入Maven包...

如何让他和
2016/09/30
75
3
(五) 整合spring cloud云服务架构 - 云架构代码结构构建

上一篇介绍了《整合spring cloud云服务架构 - 企业分布式微服务云架构图》,本篇我们根据架构图进行代码的构建。根据微服务化设计思想,结合spring cloud一些优秀的项目,如服务发现、治理、...

明理萝
2018/11/22
0
0
Java B2B2C多用户商城 springcloud架构-云架构代码结构构建(五)

上一篇介绍了《整合spring cloud云服务架构 - 企业分布式微服务云架构图》,本篇我们根据架构图进行代码的构建。根据微服务化设计思想,结合spring cloud一些优秀的项目,如服务发现、治理、...

itcloud
2018/12/12
0
0

没有更多内容

加载失败,请刷新页面

加载更多

sass和less的优缺点

简述 sass和less都是css的预编译处理语言,他们引入了mixins,参数,嵌套规则,运算,颜色,名字空间,作用域,JavaScript赋值等 加快了css开发效率,当然这两者都可以配合gulp和grunt等前端构...

莫西摩西
43分钟前
0
0
信号量与PV操作

在计算机操作系统中,PV操作是进程管理中的难点。 首先应弄清PV操作的含义:PV操作由P操作原语和V操作原语组成(原语是不可中断的过程),对信号量进行操作,具体定义如下: P(S):①将信号...

shzwork
55分钟前
0
0
重新认识网络通信协议

OSI网络分层 应用层 http, smtp,pop3这些都属于应用层协议 为用户的应用程序提供服务 表示层 确保一个系统的应用层发送的信息被另一个系统的应用层接收到 会话层 通过传输层建立数据传输的通...

最胖的瘦子
今天
2
0
【转】分布式数据流的轻量级异步快照

本篇翻译自论文:Lightweight Asynchronous Snapshots for Distributed Dataflows,Flink的容错快照模型即来源于该论文。原文地址:https://arxiv.org/pdf/1506.08603.pdf 分布式数据流的轻量...

yiduwangkai
今天
1
0
java使用反射机制设置私有成员变量的值

写一个方法:public void setProperty(Objectobj, String propertyName, Object value){}, 此方法可将obj对象中名为propertyName的属性的值设置为value。(这里不知道obj对象的propertyNam...

群星纪元
今天
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部