当前位置:首页 > springmvc框架搭建之xml配置说明(spring4+hibernate4)
SpringMVC框架搭建说明
Spring4.1.4 + hibernate4.3.8
1、web.xml配置
程序运行时从web.xml开始,加载顺序为:context-param -> listener -> filter ->structs (如果使用structs的话)-> servlet 如下为web.xml的配置说明
xmlns:web=\xsi:schemaLocation=\ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\version=\ org.springframework.web.context.ContextLoaderListener org.springframework.web.filter.CharacterEncodingFilter org.springframework.web.servlet.DispatcherServlet
2、applicationContext-common.xml配置:
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd\ 这个配置就可以省略(以下配置包含了 class=\ class=\ class=\Processor\ /> expression=\ />
3、application. properties配置
jdbc.driverClassName=org.postgresql.Driver jdbc.url=jdbc:postgresql://ip:5432/数据库名 jdbc.username=postgres jdbc.password=123
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect hibernate.show_sql=true hibernate.format_sql=false
4、spring-mvc.xml配置
xmlns:context=\ xmlns:mvc=\ xmlns:p=\ xmlns:xsi=\ xmlns:tx=\ xsi:schemaLocation=\ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd \ use-default-filters=\> class=\Resolver\>
共分享92篇相关文档