spring context 例子
来源:互联网 发布:淘宝店淘金币怎么设置 编辑:程序博客网 时间:2024/05/16 17:52
<?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:c="http://www.springframework.org/schema/c"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:task="http://www.springframework.org/schema/task"
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/cache http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.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/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.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">
<context:component-scan base-package="com.lee" />
<bean class="org.springframework.validation.beanvalidation.MethodValidationPostProcessor" />
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
<property name="objectMapper" ref="myJacksonObjectMapper" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<bean id="keyGenerator" class="com.lee.CacheKeyGenerator"/>
<cache:annotation-driven cache-manager="cacheManager" key-generator="keyGenerator"/>
<tx:annotation-driven transaction-manager="transactionManager" />
<aop:config>
<aop:aspect id="logAspect" ref="logAspect">
<aop:pointcut expression="execution(* com.lee.service.impl.*.*(..))" id="service"/>
<aop:around pointcut-ref="service" method="doAround"/>
<aop:pointcut expression="execution(* com.lee.controller.*.*(..))" id="controller"/>
<aop:around pointcut-ref="controller" method="doAround"/>
</aop:aspect>
</aop:config>
<bean id="logAspect" class="com.fil.ap.api.framework.interceptor.LoggingInterceptor"/>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="myDataSource" />
</bean>
<bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/MYDataSource" />
<property name="resourceRef" value="true" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="myDaffeDataSource" />
<property name="mapperLocations" value="classpath*:mappers/**/*.xml" />
</bean>
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="annotationClass" value="org.springframework.stereotype.Repository"/>
<property name="basePackage" value="com.fil.ap.api.hk.retail.mapper" />
<!-- need below line when there're more than one data sources -->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
----------------------------------------------分割线----------------------------------------------
<!--ehcache-->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cache-manager-ref="ehcache" />
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:config-location="classpath:ehcache.xml" p:shared="true" />
<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:c="http://www.springframework.org/schema/c"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:task="http://www.springframework.org/schema/task"
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/cache http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.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/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.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">
<context:component-scan base-package="com.lee" />
<bean class="org.springframework.validation.beanvalidation.MethodValidationPostProcessor" />
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
<property name="objectMapper" ref="myJacksonObjectMapper" />
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<bean id="keyGenerator" class="com.lee.CacheKeyGenerator"/>
<cache:annotation-driven cache-manager="cacheManager" key-generator="keyGenerator"/>
<tx:annotation-driven transaction-manager="transactionManager" />
<aop:config>
<aop:aspect id="logAspect" ref="logAspect">
<aop:pointcut expression="execution(* com.lee.service.impl.*.*(..))" id="service"/>
<aop:around pointcut-ref="service" method="doAround"/>
<aop:pointcut expression="execution(* com.lee.controller.*.*(..))" id="controller"/>
<aop:around pointcut-ref="controller" method="doAround"/>
</aop:aspect>
</aop:config>
<bean id="logAspect" class="com.fil.ap.api.framework.interceptor.LoggingInterceptor"/>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="myDataSource" />
</bean>
<bean id="myDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/MYDataSource" />
<property name="resourceRef" value="true" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="myDaffeDataSource" />
<property name="mapperLocations" value="classpath*:mappers/**/*.xml" />
</bean>
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="annotationClass" value="org.springframework.stereotype.Repository"/>
<property name="basePackage" value="com.fil.ap.api.hk.retail.mapper" />
<!-- need below line when there're more than one data sources -->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
<bean id="myJacksonObjectMapper" class="com.lee.MyJacksonObjectMapper" />
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/*"/>
<bean id="myInterceptor1" class="com.lee.MyInterceptor1"/>
</mvc:interceptor>
<mvc:interceptor>
<mvc:mapping path="/*"/>
<bean id="myInterceptor2" class="com.lee.MyInterceptor2"/>
</mvc:interceptor>
</mvc:interceptors>
</beans>
----------------------------------------------分割线----------------------------------------------
<!--ehcache-->
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cache-manager-ref="ehcache" />
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:config-location="classpath:ehcache.xml" p:shared="true" />
0 0
- spring context 例子
- Spring Context
- spring context
- spring context
- Java for Web学习笔记(五五):Spring框架简介(4)多Context的例子
- Spring Context配置
- Spring Application Context
- Spring Service Application Context
- spring - context:component-scan
- spring <context:annotation-config/>
- Spring <context:annotation-config/>
- spring context:component-scan
- spring - servlet-context.xml
- Getting Spring Application Context
- Spring-----<context:annotation-config/>
- Spring <context:annotation-config/>
- Spring Context 启动错误
- spring Context initialization failed
- Struts2中使用Json+Jquery+Ajax,以及出现的404异常及解决办法,
- Linux 初始 RAM 磁盘(initrd)概述
- SEO接单需谨慎 并非所有的单子都能接
- nodeJS 学习一【Hello World 篇】
- 最新!ENVI 5.1 遥感图像处理软件(含license.dat许可亲测可用)
- spring context 例子
- 存储那些事儿(四):传统商业存储融入云计算之路
- SEO整站优化提升企业品牌知名度
- 去哪儿笔试解决方案二(java)
- Python __class__
- seo文章站谈谈如何做更多更好的链接
- SEO文章第一个月总结
- 多线程五共享数据
- 十六进制转换为十进制