Spring4复习之Spring4 整合 Hibernate4、Struts2(Maven版)

矫情吗;* 2022-05-18 10:45 284阅读 0赞

目录结构:

70

pom.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>cn.java68</groupId>
  6. <artifactId>Demo_S2S4H4</artifactId>
  7. <version>1.0-SNAPSHOT</version>
  8. <packaging>war</packaging>
  9. <name>Demo_S2S4H4 Maven Webapp</name>
  10. <!-- FIXME change it to the project's website -->
  11. <url>http://www.example.com</url>
  12. <properties>
  13. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  14. <maven.compiler.source>1.7</maven.compiler.source>
  15. <maven.compiler.target>1.7</maven.compiler.target>
  16. </properties>
  17. <dependencies>
  18. <dependency>
  19. <groupId>junit</groupId>
  20. <artifactId>junit</artifactId>
  21. <version>4.11</version>
  22. <scope>test</scope>
  23. </dependency>
  24. <!--Struts2依赖-->
  25. <dependency>
  26. <groupId>org.apache.struts</groupId>
  27. <artifactId>struts2-core</artifactId>
  28. <version>2.3.16.3</version>
  29. </dependency>
  30. <dependency>
  31. <groupId>antlr</groupId>
  32. <artifactId>antlr</artifactId>
  33. <version>2.7.7</version>
  34. </dependency>
  35. <dependency>
  36. <groupId>net.sf.ezmorph</groupId>
  37. <artifactId>ezmorph</artifactId>
  38. <version>1.0.6</version>
  39. </dependency>
  40. <dependency>
  41. <groupId>org.apache.struts</groupId>
  42. <artifactId>struts2-spring-plugin</artifactId>
  43. <version>2.3.16.3</version>
  44. </dependency>
  45. <!--Spring依赖-->
  46. <dependency>
  47. <groupId>org.springframework</groupId>
  48. <artifactId>spring-context</artifactId>
  49. <version>4.0.6.RELEASE</version>
  50. </dependency>
  51. <dependency>
  52. <groupId>org.springframework</groupId>
  53. <artifactId>spring-core</artifactId>
  54. <version>4.0.6.RELEASE</version>
  55. </dependency>
  56. <dependency>
  57. <groupId>org.springframework</groupId>
  58. <artifactId>spring-beans</artifactId>
  59. <version>4.0.6.RELEASE</version>
  60. </dependency>
  61. <dependency>
  62. <groupId>org.springframework</groupId>
  63. <artifactId>spring-tx</artifactId>
  64. <version>4.0.6.RELEASE</version>
  65. </dependency>
  66. <dependency>
  67. <groupId>org.springframework</groupId>
  68. <artifactId>spring-web</artifactId>
  69. <version>4.0.6.RELEASE</version>
  70. </dependency>
  71. <dependency>
  72. <groupId>org.springframework</groupId>
  73. <artifactId>spring-webmvc</artifactId>
  74. <version>4.0.6.RELEASE</version>
  75. </dependency>
  76. <dependency>
  77. <groupId>org.springframework</groupId>
  78. <artifactId>spring-jdbc</artifactId>
  79. <version>4.0.6.RELEASE</version>
  80. </dependency>
  81. <dependency>
  82. <groupId>org.springframework</groupId>
  83. <artifactId>spring-context-support</artifactId>
  84. <version>4.0.6.RELEASE</version>
  85. </dependency>
  86. <dependency>
  87. <groupId>org.aspectj</groupId>
  88. <artifactId>aspectjweaver</artifactId>
  89. <version>1.8.10</version>
  90. </dependency>
  91. <dependency>
  92. <groupId>org.springframework</groupId>
  93. <artifactId>spring-orm</artifactId>
  94. <version>4.0.6.RELEASE</version>
  95. </dependency>
  96. <!-- Hibernate依赖 -->
  97. <dependency>
  98. <groupId>org.hibernate</groupId>
  99. <artifactId>hibernate-core</artifactId>
  100. <version>4.3.5.Final</version>
  101. </dependency>
  102. <dependency>
  103. <groupId>net.sf.ehcache</groupId>
  104. <artifactId>ehcache-core</artifactId>
  105. <version>2.4.3</version>
  106. </dependency>
  107. <dependency>
  108. <groupId>org.hibernate</groupId>
  109. <artifactId>hibernate-c3p0</artifactId>
  110. <version>4.3.5.Final</version>
  111. </dependency>
  112. <!-- mysql驱动依赖 -->
  113. <dependency>
  114. <groupId>mysql</groupId>
  115. <artifactId>mysql-connector-java</artifactId>
  116. <version>5.1.35</version>
  117. </dependency>
  118. <!--<dependency>-->
  119. <!--<groupId>javax.servlet.jsp</groupId>-->
  120. <!--<artifactId>javax.servlet.jsp-api</artifactId>-->
  121. <!--<version>2.2.1</version>-->
  122. <!--<scope>provided</scope>-->
  123. <!--</dependency>-->
  124. <!--<dependency>-->
  125. <!--<groupId>javax.servlet</groupId>-->
  126. <!--<artifactId>javax.servlet-api</artifactId>-->
  127. <!--<version>3.1.0</version>-->
  128. <!--<scope>provided</scope>-->
  129. <!--</dependency>-->
  130. </dependencies>
  131. <build>
  132. <finalName>Demo_S2S4H4</finalName>
  133. <pluginManagement>
  134. <plugins>
  135. <plugin>
  136. <artifactId>maven-clean-plugin</artifactId>
  137. <version>3.0.0</version>
  138. </plugin>
  139. <plugin>
  140. <artifactId>maven-resources-plugin</artifactId>
  141. <version>3.0.2</version>
  142. </plugin>
  143. <plugin>
  144. <artifactId>maven-compiler-plugin</artifactId>
  145. <version>3.7.0</version>
  146. </plugin>
  147. <plugin>
  148. <artifactId>maven-surefire-plugin</artifactId>
  149. <version>2.20.1</version>
  150. </plugin>
  151. <plugin>
  152. <artifactId>maven-war-plugin</artifactId>
  153. <version>3.2.0</version>
  154. </plugin>
  155. <plugin>
  156. <artifactId>maven-install-plugin</artifactId>
  157. <version>2.5.2</version>
  158. </plugin>
  159. <plugin>
  160. <artifactId>maven-deploy-plugin</artifactId>
  161. <version>2.8.2</version>
  162. </plugin>
  163. </plugins>
  164. </pluginManagement>
  165. </build>
  166. </project>

UserAction.java

70 1

BaseDaOImpl.java

70 2

70 3

70 4

BaseDao.java

70 5

70 6

70 7

70 8

70 9

User.java

70 10

UserServiceImpl.java

70 11

UserService.java

70 12

applicationContext.xml

70 13

70 14

hibernate.cfg.xml

70 15

struts.xml

70 16

web.xml

70 17

index.jsp

70 18

70 19

要用到的工具,视频教程,关注公众号(Java学习之乐)直接免费获取:

70 20

发表评论

表情:
评论列表 (有 0 条评论,284人围观)

还没有评论,来说两句吧...

相关阅读

    相关 spring4 hibernate4(5) 整合

    纸上得来终觉浅 1.前面学了Spring具有两个重要特性,IOC和AOP,利用这些特性可以优化代码框架; 既然如此,那么在使用Hibernate时,就可以利用Spring框架