标签:scope lap -418 .com test man nat war oca
一、由myeclipse新建Javaweb项目,先添加spring支持,添加完后再添加Struts支持。
注:在添加Struts支持之前先在src/main/java下新建一个包,然后生成一个HibernateSessionFactory.java文件
二、配置一下配置文件
1、applicationContext.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans 3 xmlns="http://www.springframework.org/schema/beans" 4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 5 xmlns:p="http://www.springframework.org/schema/p" 6 xsi:schemaLocation="http://www.springframework.org/schema/beans 7 http://www.springframework.org/schema/beans/spring-beans-4.1.xsd 8 http://www.springframework.org/schema/tx 9 http://www.springframework.org/schema/tx/spring-tx.xsd" 10 xmlns:tx="http://www.springframework.org/schema/tx"> 11 12 13 <bean id="dataSource" 14 class="org.apache.commons.dbcp.BasicDataSource"> 15 <property name="url" 16 value="jdbc:mysql://localhost:3306/testmysql"> 17 </property> 18 <property name="driverClassName" value="com.mysql.jdbc.Driver" /> 19 <property name="username" value="root"></property> 20 <property name="password" value="zW1234@32"></property> 21 22 </bean> 23 <bean id="sessionFactory" 24 class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> 25 <property name="dataSource"> 26 <ref bean="dataSource" /> 27 </property> 28 <property name="hibernateProperties"> 29 <props> 30 <prop key="hibernate.dialect"> 31 org.hibernate.dialect.MySQLDialect 32 </prop> 33 </props> 34 </property> 35 </bean> 36 <bean id="transactionManager" 37 class="org.springframework.orm.hibernate4.HibernateTransactionManager"> 38 <property name="sessionFactory" ref="sessionFactory" /> 39 </bean> 40 <tx:annotation-driven transaction-manager="transactionManager" /></beans>
2、log4j.properties
1 log4j.rootLogger=DEBUG,A1 2 log4j.appender.A1=org.apache.log4j.ConsoleAppender 3 log4j.appender.A1.layout=org.apache.log4j.PatternLayout 4 log4j.appender.A1.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss,SSS} [%t] [%c]-[%p] %m%n
3、pom.xml
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 2 <modelVersion>4.0.0</modelVersion> 3 <groupId>SSH</groupId> 4 <artifactId>SSH</artifactId> 5 <version>0.0.1-SNAPSHOT</version> 6 <packaging>war</packaging> 7 <name>SSH</name> 8 <description/> 9 <properties> 10 <webVersion>3.1</webVersion> 11 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 12 </properties> 13 <dependencies> 14 <dependency> 15 <groupId>javax</groupId> 16 <artifactId>javaee-api</artifactId> 17 <version>7.0</version> 18 <scope>provided</scope> 19 </dependency> 20 <dependency> 21 <groupId>org.glassfish.web</groupId> 22 <artifactId>javax.servlet.jsp.jstl</artifactId> 23 <version>1.2.2</version> 24 </dependency> 25 <dependency> 26 <groupId>org.springframework</groupId> 27 <artifactId>spring-aop</artifactId> 28 <version>4.1.0.RELEASE</version> 29 </dependency> 30 <dependency> 31 <groupId>org.springframework</groupId> 32 <artifactId>spring-aspects</artifactId> 33 <version>4.1.0.RELEASE</version> 34 </dependency> 35 <dependency> 36 <groupId>org.springframework</groupId> 37 <artifactId>spring-beans</artifactId> 38 <version>4.1.0.RELEASE</version> 39 </dependency> 40 <dependency> 41 <groupId>org.springframework</groupId> 42 <artifactId>spring-context</artifactId> 43 <version>4.1.0.RELEASE</version> 44 </dependency> 45 <dependency> 46 <groupId>org.springframework</groupId> 47 <artifactId>spring-context-support</artifactId> 48 <version>4.1.0.RELEASE</version> 49 </dependency> 50 <dependency> 51 <groupId>org.springframework</groupId> 52 <artifactId>spring-expression</artifactId> 53 <version>4.1.0.RELEASE</version> 54 </dependency> 55 <dependency> 56 <groupId>org.springframework</groupId> 57 <artifactId>spring-instrument</artifactId> 58 <version>4.1.0.RELEASE</version> 59 </dependency> 60 <dependency> 61 <groupId>org.springframework</groupId> 62 <artifactId>spring-instrument-tomcat</artifactId> 63 <version>4.1.0.RELEASE</version> 64 </dependency> 65 <dependency> 66 <groupId>org.springframework</groupId> 67 <artifactId>spring-core</artifactId> 68 <version>4.1.0.RELEASE</version> 69 </dependency> 70 <dependency> 71 <groupId>aopalliance</groupId> 72 <artifactId>aopalliance</artifactId> 73 <version>1.0</version> 74 </dependency> 75 <dependency> 76 <groupId>log4j</groupId> 77 <artifactId>log4j</artifactId> 78 <version>1.2.17</version> 79 </dependency> 80 <dependency> 81 <groupId>org.aspectj</groupId> 82 <artifactId>aspectjweaver</artifactId> 83 <version>1.8.2</version> 84 </dependency> 85 <dependency> 86 <groupId>org.springframework</groupId> 87 <artifactId>spring-web</artifactId> 88 <version>4.1.0.RELEASE</version> 89 </dependency> 90 <dependency> 91 <groupId>org.springframework</groupId> 92 <artifactId>spring-webmvc</artifactId> 93 <version>4.1.0.RELEASE</version> 94 </dependency> 95 <dependency> 96 <groupId>org.springframework</groupId> 97 <artifactId>spring-webmvc-portlet</artifactId> 98 <version>4.1.0.RELEASE</version> 99 </dependency> 100 <dependency> 101 <groupId>org.springframework</groupId> 102 <artifactId>spring-jms</artifactId> 103 <version>4.1.0.RELEASE</version> 104 </dependency> 105 <dependency> 106 <groupId>org.springframework</groupId> 107 <artifactId>spring-oxm</artifactId> 108 <version>4.1.0.RELEASE</version> 109 </dependency> 110 <dependency> 111 <groupId>org.springframework.security</groupId> 112 <artifactId>spring-security-web</artifactId> 113 <version>3.2.5.RELEASE</version> 114 </dependency> 115 <dependency> 116 <groupId>org.springframework.security</groupId> 117 <artifactId>spring-security-core</artifactId> 118 <version>3.2.5.RELEASE</version> 119 </dependency> 120 <dependency> 121 <groupId>org.springframework.security</groupId> 122 <artifactId>spring-security-acl</artifactId> 123 <version>3.2.5.RELEASE</version> 124 </dependency> 125 <dependency> 126 <groupId>org.springframework.security</groupId> 127 <artifactId>spring-security-aspects</artifactId> 128 <version>3.2.5.RELEASE</version> 129 </dependency> 130 <dependency> 131 <groupId>org.springframework.security</groupId> 132 <artifactId>spring-security-cas</artifactId> 133 <version>3.2.5.RELEASE</version> 134 </dependency> 135 <dependency> 136 <groupId>org.springframework.security</groupId> 137 <artifactId>spring-security-config</artifactId> 138 <version>3.2.5.RELEASE</version> 139 </dependency> 140 <dependency> 141 <groupId>org.springframework.security</groupId> 142 <artifactId>spring-security-crypto</artifactId> 143 <version>3.2.5.RELEASE</version> 144 </dependency> 145 <dependency> 146 <groupId>org.springframework.security</groupId> 147 <artifactId>spring-security-ldap</artifactId> 148 <version>3.2.5.RELEASE</version> 149 </dependency> 150 <dependency> 151 <groupId>org.springframework.security</groupId> 152 <artifactId>spring-security-openid</artifactId> 153 <version>3.2.5.RELEASE</version> 154 </dependency> 155 <dependency> 156 <groupId>org.springframework.security</groupId> 157 <artifactId>spring-security-remoting</artifactId> 158 <version>3.2.5.RELEASE</version> 159 </dependency> 160 <dependency> 161 <groupId>org.springframework.security</groupId> 162 <artifactId>spring-security-taglibs</artifactId> 163 <version>3.2.5.RELEASE</version> 164 </dependency> 165 <dependency> 166 <groupId>org.springframework.webflow</groupId> 167 <artifactId>spring-webflow</artifactId> 168 <version>2.4.0.RELEASE</version> 169 </dependency> 170 <dependency> 171 <groupId>org.springframework.webflow</groupId> 172 <artifactId>spring-binding</artifactId> 173 <version>2.4.0.RELEASE</version> 174 </dependency> 175 <dependency> 176 <groupId>org.springframework.webflow</groupId> 177 <artifactId>spring-js</artifactId> 178 <version>2.4.0.RELEASE</version> 179 </dependency> 180 <dependency> 181 <groupId>org.springframework.webflow</groupId> 182 <artifactId>spring-js-resources</artifactId> 183 <version>2.4.0.RELEASE</version> 184 </dependency> 185 <dependency> 186 <groupId>opensymphony</groupId> 187 <artifactId>ognl</artifactId> 188 <version>2.6.11</version> 189 </dependency> 190 <dependency> 191 <groupId>antlr</groupId> 192 <artifactId>antlr</artifactId> 193 <version>2.7.7</version> 194 </dependency> 195 <dependency> 196 <groupId>org.slf4j</groupId> 197 <artifactId>slf4j-api</artifactId> 198 <version>1.6.1</version> 199 </dependency> 200 <dependency> 201 <groupId>dom4j</groupId> 202 <artifactId>dom4j</artifactId> 203 <version>1.6.1</version> 204 </dependency> 205 <dependency> 206 <groupId>org.hibernate</groupId> 207 <artifactId>hibernate-core</artifactId> 208 <version>4.1.4.Final</version> 209 </dependency> 210 <dependency> 211 <groupId>org.hibernate.common</groupId> 212 <artifactId>hibernate-commons-annotations</artifactId> 213 <version>4.0.1.Final</version> 214 </dependency> 215 <dependency> 216 <groupId>org.hibernate.javax.persistence</groupId> 217 <artifactId>hibernate-jpa-2.0-api</artifactId> 218 <version>1.0.1.Final</version> 219 </dependency> 220 <dependency> 221 <groupId>org.javassist</groupId> 222 <artifactId>javassist</artifactId> 223 <version>3.15.0-GA</version> 224 </dependency> 225 <dependency> 226 <groupId>org.jboss.logging</groupId> 227 <artifactId>jboss-logging</artifactId> 228 <version>3.1.0.GA</version> 229 </dependency> 230 <dependency> 231 <groupId>org.jboss.spec.javax.transaction</groupId> 232 <artifactId>jboss-transaction-api_1.1_spec</artifactId> 233 <version>1.0.0.Final</version> 234 </dependency> 235 <dependency> 236 <groupId>org.hibernate</groupId> 237 <artifactId>hibernate-entitymanager</artifactId> 238 <version>4.1.4.Final</version> 239 </dependency> 240 <dependency> 241 <groupId>org.hibernate</groupId> 242 <artifactId>hibernate-validator</artifactId> 243 <version>4.2.0.Final</version> 244 </dependency> 245 <dependency> 246 <groupId>xml-apis</groupId> 247 <artifactId>xml-apis</artifactId> 248 <version>1.4.01</version> 249 </dependency> 250 <dependency> 251 <groupId>mysql</groupId> 252 <artifactId>mysql-connector-java</artifactId> 253 <version>5.1.26</version> 254 </dependency> 255 <dependency> 256 <groupId>org.springframework</groupId> 257 <artifactId>spring-orm</artifactId> 258 <version>4.1.4.RELEASE</version> 259 </dependency> 260 <dependency> 261 <groupId>commons-pool</groupId> 262 <artifactId>commons-pool</artifactId> 263 <version>1.6</version> 264 </dependency> 265 <dependency> 266 <groupId>org.apache.commons</groupId> 267 <artifactId>commons-collections4</artifactId> 268 <version>4.1</version> 269 </dependency> 270 <dependency> 271 <groupId>commons-dbcp</groupId> 272 <artifactId>commons-dbcp</artifactId> 273 <version>1.4</version> 274 </dependency> 275 <dependency> 276 <groupId>org.slf4j</groupId> 277 <artifactId>slf4j-nop</artifactId> 278 <version>1.7.2</version> 279 </dependency> 280 </dependencies> 281 <build> 282 <plugins> 283 <plugin> 284 <artifactId>maven-compiler-plugin</artifactId> 285 <version>2.3.2</version> 286 <configuration> 287 <source>1.8</source> 288 <target>1.8</target> 289 </configuration> 290 </plugin> 291 <plugin> 292 <artifactId>maven-war-plugin</artifactId> 293 <version>2.6</version> 294 <configuration> 295 <failOnMissingWebXml>false</failOnMissingWebXml> 296 </configuration> 297 </plugin> 298 </plugins> 299 </build> 300 </project>
myeclipse搭建SSH(Struts+spring+hibernate)由maven管理
标签:scope lap -418 .com test man nat war oca
原文地址:https://www.cnblogs.com/jimi-tom/p/10268878.html