springMVC的xml相关配置
来源:互联网 发布:银行核心业务系统数据 编辑:程序博客网 时间:2024/05/30 04:29
<?
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:aop
=
"http://www.springframework.org/schema/aop"
xmlns:context
=
"http://www.springframework.org/schema/context"
xmlns:mvc
=
"http://www.springframework.org/schema/mvc"
xmlns:jee
=
"http://www.springframework.org/schema/jee"
xmlns:lang
=
"http://www.springframework.org/schema/lang"
xmlns:p
=
"http://www.springframework.org/schema/p"
xmlns:tx
=
"http://www.springframework.org/schema/tx"
xmlns:util
=
"http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- <context:component-scan base-package="package_name"/> -->
<
context:component-scan
base-package
=
"org.lee"
/>
<
mvc:annotation-driven
/>
<!-- 注解实现日记记录 -->
<
aop:aspectj-autoproxy
/>
<
bean
class
=
"org.springframework.web.servlet.view.InternalResourceViewResolver"
>
<
property
name
=
"prefix"
value
=
"/WEB-INF/view/"
/>
<!-- path before request -->
<
property
name
=
"suffix"
value
=
".jsp"
/>
<!-- suffix -->
</
bean
>
<!-- 国际化 -->
<
bean
id
=
"messageSource"
class
=
"org.springframework.context.support.ResourceBundleMessageSource"
>
<
property
name
=
"basenames"
value
=
"i18n.message"
></
property
>
<
property
name
=
"defaultEncoding"
value
=
"UTF-8"
/>
</
bean
>
<!-- 基于Session的国际化配置 -->
<
bean
id
=
"localeResolver"
class
=
"org.springframework.web.servlet.i18n.SessionLocaleResolver"
></
bean
>
<!-- 动态语言切换 -->
<
bean
id
=
"localeChangeInterceptor"
class
=
"org.springframework.web.servlet.i18n.LocaleChangeInterceptor"
>
<
property
name
=
"paramName"
value
=
"locale"
/>
</
bean
>
<!-- 静态资源访问 -->
<
mvc:resources
location
=
"/My97DatePicker/"
mapping
=
"/My97DatePicker/**"
/>
<
mvc:resources
location
=
"/static/lib/"
mapping
=
"/static/lib/**"
/>
<
mvc:resources
location
=
"/static/css/"
mapping
=
"/static/css/**"
/>
<
mvc:resources
location
=
"/static/assets/"
mapping
=
"/static/assets/**"
/>
<
mvc:resources
location
=
"/static/js/"
mapping
=
"/static/js/**"
/>
<
mvc:resources
location
=
"/static/js/jqprint/"
mapping
=
"/static/js/jqprint/**"
/>
<
mvc:resources
location
=
"/static/bootstrap-3.3.5-dist/css/"
mapping
=
"/static/bootstrap-3.3.5-dist/css/**"
/>
<
mvc:resources
location
=
"/static/bootstrap-3.3.5-dist/js/"
mapping
=
"/static/bootstrap-3.3.5-dist/js/**"
/>
<
mvc:resources
location
=
"/static/bootstrap-3.3.5-dist/fonts/"
mapping
=
"/static/bootstrap-3.3.5-dist/fonts/**"
/>
<!-- Bootstrap-Multiselect -->
<
mvc:resources
location
=
"/static/bootstrap-multiselect-0.9.13/dist/css/"
mapping
=
"/static/bootstrap-multiselect-0.9.13/dist/css/**"
/>
<
mvc:resources
location
=
"/static/bootstrap-multiselect-0.9.13/dist/js/"
mapping
=
"/static/bootstrap-multiselect-0.9.13/dist/js/**"
/>
<
mvc:resources
location
=
"/static/bootstrap-multiselect-0.9.13/dist/less/"
mapping
=
"/static/bootstrap-multiselect-0.9.13/dist/less/**"
/>
<
mvc:resources
location
=
"/static/bootstrap-multiselect-0.9.13/docs/css/"
mapping
=
"/static/bootstrap-multiselect-0.9.13/docs/css/**"
/>
<
mvc:resources
location
=
"/static/bootstrap-multiselect-0.9.13/docs/js/"
mapping
=
"/static/bootstrap-multiselect-0.9.13/docs/js/**"
/>
<
mvc:resources
location
=
"/static/bootstrap-multiselect-0.9.13/docs/less/"
mapping
=
"/static/bootstrap-multiselect-0.9.13/docs/less/**"
/>
<!-- JSR 303 Validator -->
<
bean
id
=
"validator"
class
=
"org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"
>
<
property
name
=
"providerClass"
value
=
"org.hibernate.validator.HibernateValidator"
/>
<
property
name
=
"validationMessageSource"
ref
=
"messageSource"
/>
</
bean
>
<
mvc:annotation-driven
validator
=
"validator"
/>
<!-- 数据库配置 -->
<
bean
id
=
"dataSource"
class
=
"com.alibaba.druid.pool.DruidDataSource"
init-method
=
"init"
destroy-method
=
"close"
>
<!-- MySQL数据库配置 -->
<
property
name
=
"url"
value
=
"jdbc:mysql://localhost:3306/apj?useUnicode=true&characterEncoding=utf-8"
/>
<
property
name
=
"username"
value
=
"root"
/>
<
property
name
=
"password"
value
=
"123456"
/>
</
bean
>
<!-- 配置jdbcTemplate -->
<
bean
id
=
"jdbcTemplate"
class
=
"org.springframework.jdbc.core.JdbcTemplate"
abstract
=
"false"
lazy-init
=
"false"
autowire
=
"default"
>
<
property
name
=
"dataSource"
>
<
ref
bean
=
"dataSource"
/>
</
property
>
</
bean
>
<!--配置Hibernate -->
<
bean
id
=
"sessionFactory"
class
=
"org.springframework.orm.hibernate4.LocalSessionFactoryBean"
>
<
property
name
=
"dataSource"
ref
=
"dataSource"
/>
<
property
name
=
"packagesToScan"
value
=
"org.lee.model"
></
property
>
<
property
name
=
"hibernateProperties"
>
<
props
>
<!-- 方言 -->
<
prop
key
=
"dialect"
>org.hibernate.dialect.MySQL5Dialect</
prop
>
<!-- 控制台显示SQL -->
<
prop
key
=
"show_sql"
>true</
prop
>
<!-- 自动更新表结构 -->
<
prop
key
=
"hbm2ddl.auto"
>update</
prop
>
</
props
>
</
property
>
</
bean
>
<!--配置Hibernate事务 -->
<
bean
id
=
"transactionManager"
class
=
"org.springframework.orm.hibernate4.HibernateTransactionManager"
>
<
property
name
=
"sessionFactory"
ref
=
"sessionFactory"
/>
</
bean
>
<
tx:annotation-driven
transaction-manager
=
"transactionManager"
/>
<!-- 考题管理的ajax相关配置 -->
<
bean
class
=
"org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"
>
<
property
name
=
"messageConverters"
>
<
list
>
<
ref
bean
=
"mappingJackson2HttpMessageConverter"
/>
</
list
>
</
property
>
</
bean
>
<
bean
id
=
"mappingJackson2HttpMessageConverter"
class
=
"org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"
>
<
property
name
=
"supportedMediaTypes"
>
<
list
>
<
value
>application/json;charset=UTF-8</
value
>
<
value
>text/html;charset=UTF-8</
value
>
<
value
>text/json;charset=UTF-8</
value
>
</
list
>
</
property
>
</
bean
>
<!-- 上传 -->
<
bean
id
=
"multipartResolver"
class
=
"org.springframework.web.multipart.commons.CommonsMultipartResolver"
/>
<!-- 登录权限 -->
<
mvc:interceptors
>
<
mvc:interceptor
>
<
mvc:mapping
path
=
"/**"
/>
<
mvc:exclude-mapping
path
=
"/login"
/>
<
mvc:exclude-mapping
path
=
"/logout"
/>
<
mvc:exclude-mapping
path
=
"/static"
/>
<
bean
class
=
"org.lee.Interceptor.LoginInterceptor"
></
bean
>
</
mvc:interceptor
>
</
mvc:interceptors
>
</
beans
>
阅读全文
1 0
- springMVC的xml相关配置
- SpringMVC的相关配置
- SpringMVC注解开发springmvc.xml的配置
- SpringMVC的XML配置方式
- SpringMVC的xml配置开发
- SpringMVC xml的配置写法
- SpringMVC的web.xml配置
- SpringMVC之application-context.xml,了解数据库相关配置
- springMVC与Redis整合及pom.xml相关配置
- web.xml的相关配置
- animation的XML相关配置
- XML文件的相关配置
- springmvc 和 mybatis 的相关配置
- SpringMvc的xml文件的配置
- SpringMVC的web.xml的配置。
- SpringMVC的web.xml的配置
- SpringMvc的xml文件的配置
- SpringMVC学习之springMVC项目的相关配置文件配置
- Java String类常用方法介绍(5)
- 说说 Objective-C 里的 @()
- HDU 2030 汉字统计
- JAVA 比较两个日期相差的天数
- 总结/多态
- springMVC的xml相关配置
- 关于项目开发和管理的思考和成长
- django 用户认证
- SVD++
- 【C语言】预处理(部分内容未整理)
- 入门:学习《Head First HTML与CSS》
- 索引
- 从输入URL到页面加载显示完成的过程
- 8.活动的启动模式