博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
maven构建spring4-hibernate4-webapp
阅读量:7052 次
发布时间:2019-06-28

本文共 10858 字,大约阅读时间需要 36 分钟。

  hot3.png

mvn archetype:generate -DgroupId=com.persia -DartifactId=yamissh -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

1、建立java,test/java,test/resources文件夹

2、配置pom文件

  
4.0.0
  
com.persia
  
yamissh
  
war
  
1.0-SNAPSHOT
  
yamissh Maven Webapp
  
http://maven.apache.org
    
        
4.0.0.RELEASE
        
4.3.1.Final
        
UTF-8
    
    
        
        
            
javax.servlet
            
javax.servlet-api
            
3.0.1
            
provided
        
        
        
            
org.freemarker
            
freemarker
            
2.3.20
        
        
        
            
org.codehaus.jackson
            
jackson-mapper-asl
            
1.9.13
        
        
        
            
com.google.guava
            
guava
            
15.0-rc1
        
        
        
            
commons-lang
            
commons-lang
            
2.6
        
        
            
commons-collections
            
commons-collections
            
3.2.1
        
        
            
commons-beanutils
            
commons-beanutils
            
1.8.3
        
        
            
commons-dbutils
            
commons-dbutils
            
1.5
        
        
            
commons-fileupload
            
commons-fileupload
            
1.3
        
        
            
commons-codec
            
commons-codec
            
1.8
        
        
            
commons-configuration
            
commons-configuration
            
1.10
        
        
        
            
org.slf4j
            
slf4j-log4j12
            
1.7.2
        
        
        
            
mysql
            
mysql-connector-java
            
5.1.15
        
        
        
            
c3p0
            
c3p0
            
0.9.1.2
        
        
        
            
junit
            
junit
            
4.11
            
provided
        
        
        
            
org.springframework
            
spring-core
            
${org.springframework-version}
        
        
            
org.springframework
            
spring-webmvc
            
${org.springframework-version}
        
        
            
org.springframework
            
spring-context
            
${org.springframework-version}
            
                
                
                    
commons-logging
                    
commons-logging
                
            
        
        
            
org.springframework
            
spring-orm
            
${org.springframework-version}
        
        
        
        
        
        
        
            
org.springframework
            
spring-expression
            
${org.springframework-version}
        
        
            
org.springframework
            
spring-context-support
            
${org.springframework-version}
        
        
            
org.springframework
            
spring-web
            
${org.springframework-version}
        
        
        
        
        
        
        
            
org.springframework
            
spring-aop
            
${org.springframework-version}
        
        
            
org.springframework
            
spring-beans
            
${org.springframework-version}
        
        
            
org.springframework
            
spring-tx
            
${org.springframework-version}
        
        
        
        
        
        
        
        
        
        
        
        
        
        
            
org.aspectj
            
aspectjrt
            
1.7.4
        
        
            
org.aspectj
            
aspectjweaver
            
1.7.4
        
        
        
            
org.hibernate
            
hibernate-core
            
${org.hibernate-version}
        
        
            
org.hibernate
            
hibernate-validator
            
${org.hibernate-version}
        
        
            
org.hibernate
            
hibernate-entitymanager
            
${org.hibernate-version}
        
        
            
javax.validation
            
validation-api
            
1.0.0.GA
            
provided
        
        
        
            
org.javassist
            
javassist
            
3.18.1-GA
        
        
        
        
        
        
        
        
        
        
        
    

3、配置web.xml

    
    
        
org.springframework.web.context.ContextLoaderListener
    
    
        
contextConfigLocation
        
classpath*:spring-ioc-config.xml
    
    
    
        
dispatcherServlet
        
org.springframework.web.servlet.DispatcherServlet
        
            
contextConfigLocation
            
classpath*:spring-web-context.xml
        
        
1
        
true
    
    
        
dispatcherServlet
        
/
    
    
    
        
    

4、配置数据库链接、spring-ioc和spring-web

 orm-config.properties

#config databasedatabase.driverClassName=com.mysql.jdbc.Driverdatabase.url=jdbc:mysql://localhost\:3306/demo?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNulldatabase.username=rootdatabase.password=root#config collection poolpool.initialPoolSize=1pool.minPoolSize=0pool.maxPoolSize=2pool.maxIdleTime=120pool.acquireIncrement=1#config hibernate propertieshibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialecthibernate.show_sql=falsehibernate.format_sql=falsehibernate.jdbc.batch_size=50hibernate.hibernate.connection.SetBigStringTryClob=truehibernate.hibernate.archive.autodetection=classhibernate.hibernate.connection.charSet=UTF-8hibernate.hibernate.cache.use_query_cache=falsehibernate.hibernate.cache.use_second_level_cache=falsehibernate.hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy

 spring-ioc-config.xml

    
    
    
    
    
    
        
        
        
        
        
        
        
        
        
        
    
        
        
        
            
                
${hibernate.dialect}                
${hibernate.show_sql}                
${hibernate.format_sql}                
${hibernate.jdbc.batch_size}                
${hibernate.hibernate.connection.SetBigStringTryClob}                
${hibernate.hibernate.archive.autodetection}                
${hibernate.hibernate.connection.charSet}                
${hibernate.hibernate.cache.use_query_cache}                
${hibernate.hibernate.cache.use_second_level_cache}                
${hibernate.hibernate.ejb.naming_strategy}            
                
    
        
        
    
    
    
        
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
        
        
        
        
        
    

  spring-web-context.xml

    
    
    
    
    
        
            
                
                    
                        
                            
text/plain;charset=UTF-8
                        
                                                    
                    
                        
                            
text/plain;charset=UTF-8
                            
application/json;charset=UTF-8
                        
                                                
                
    
        
        
        
            
                
10                
zh_CN                
yyyy-MM-dd HH:mm:ss                
yyyy-MM-dd                
#.##            
                
        
        
        
        
        
        
        
        
    

转载于:https://my.oschina.net/scipio/blog/197629

你可能感兴趣的文章
sqlalchemy备忘 笔记
查看>>
Python数值和字符串
查看>>
python学习笔记一
查看>>
Gym 100283F Bakkar In The Army
查看>>
POJ 2947 2947 Widget Factory 高斯消元
查看>>
ExtJS-3.4.0系列:Ext.TabPanel
查看>>
Sql Server系列:键和约束
查看>>
服务器负载感知的URL HASH
查看>>
java xml操作
查看>>
关于Android SDK无法正常下载
查看>>
LVS-DR演示
查看>>
硬件要求
查看>>
基本数据类型
查看>>
我的友情链接
查看>>
设置cpu亲和性---即 绑定特定的进程线程到指定的cpu
查看>>
Java 的强引用、弱引用、软引用、虚引用
查看>>
zabbix性能简单调优
查看>>
CSS 详细解读定位属性 position 以及参数
查看>>
ed 命令 cat 命令
查看>>
想想你,幸福和快乐就来了
查看>>