spring中的配置文件applicationContext.xml示例
来源:互联网 发布:泡妞软件下载 编辑:程序博客网 时间:2024/04/27 13:39
<?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:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<bean id="dbcp"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="username" value="root">
</property>
<property name="password" value="1234">
</property>
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql:///cloud_note?useUnicode=true&characterEncoding=utf8">
</property>
</bean>
<bean id="ssf"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dbcp">
</property>
<property name="mapperLocations"
value="classpath:org/tarena/note/sql/*.xml">
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 扫描包下接口生成实现 -->
<property name="basePackage"
value="org.tarena.note.dao">
</property>
<!-- 自动注入ssf -->
</bean>
<!-- 开启组件扫描,扫描Service,Controller -->
<context:component-scan
base-package="org.tarena.note"/>
<!-- handlermapping -->
<mvc:annotation-driven />
<!-- Spring注解事务配置 -->
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dbcp">
</property>
</bean>
<!-- @Transactional -->
<tx:annotation-driven
transaction-manager="txManager"
proxy-target-class="true"/>
<!-- AOP示例,XML配置版本 -->
<bean id="logBean"
class="org.tarena.note.aopbean.LogServiceBean">
</bean>
<aop:config>
<!-- 指定作用目标组件 -->
<aop:pointcut id="servicePoint"
expression="within(org.tarena.note.service..*)"/>
<!-- 指定作用时机 -->
<aop:aspect ref="logBean">
<aop:before method="logService"
pointcut-ref="servicePoint"/>
</aop:aspect>
</aop:config>
<!-- **注解AOP配置*** -->
<!-- 通过组件扫描将LogControllerBean纳入spring容器 -->
<!-- -开启AOP注解,@Aspect,@Pointcut,@Before -->
<aop:aspectj-autoproxy
proxy-target-class="true"/>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
<bean id="dbcp"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="username" value="root">
</property>
<property name="password" value="1234">
</property>
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql:///cloud_note?useUnicode=true&characterEncoding=utf8">
</property>
</bean>
<bean id="ssf"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dbcp">
</property>
<property name="mapperLocations"
value="classpath:org/tarena/note/sql/*.xml">
</property>
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 扫描包下接口生成实现 -->
<property name="basePackage"
value="org.tarena.note.dao">
</property>
<!-- 自动注入ssf -->
</bean>
<!-- 开启组件扫描,扫描Service,Controller -->
<context:component-scan
base-package="org.tarena.note"/>
<!-- handlermapping -->
<mvc:annotation-driven />
<!-- Spring注解事务配置 -->
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dbcp">
</property>
</bean>
<!-- @Transactional -->
<tx:annotation-driven
transaction-manager="txManager"
proxy-target-class="true"/>
<!-- AOP示例,XML配置版本 -->
<bean id="logBean"
class="org.tarena.note.aopbean.LogServiceBean">
</bean>
<aop:config>
<!-- 指定作用目标组件 -->
<aop:pointcut id="servicePoint"
expression="within(org.tarena.note.service..*)"/>
<!-- 指定作用时机 -->
<aop:aspect ref="logBean">
<aop:before method="logService"
pointcut-ref="servicePoint"/>
</aop:aspect>
</aop:config>
<!-- **注解AOP配置*** -->
<!-- 通过组件扫描将LogControllerBean纳入spring容器 -->
<!-- -开启AOP注解,@Aspect,@Pointcut,@Before -->
<aop:aspectj-autoproxy
proxy-target-class="true"/>
</beans>
0 0
- spring中的配置文件applicationContext.xml示例
- spring配置文件applicationContext.xml中的事务总结
- spring配置文件applicationContext.xml
- spring配置文件 applicationContext.xml
- Spring配置文件-applicationContext.xml
- Spring的配置文件applicationContext.xml
- Spring的配置文件applicationContext.xml
- Spring配置文件总结-applicationContext.xml
- spring applicationContext.xml 配置文件 详解
- Spring配置文件 applicationContext.xml 详解
- Spring 配置文件applicationContext.xml详解
- Spring框架配置文件:applicationContext.xml
- spring applicationContext.xml 配置文件 详解
- spring applicationContext.xml 配置文件 详解
- spring applicationContext.xml 配置文件 详解
- spring applicationContext.xml 配置文件 详解
- spring applicationContext.xml 配置文件 详解
- spring applicationContext.xml 配置文件 详解
- Android PullToRefresh 分析之一、初识PullToRefresh
- Linux指令--rm, rmdir
- 【jQuery】文本框的focus和blur事件
- JS订阅方法
- Delphi ClientDataSet复制记录
- spring中的配置文件applicationContext.xml示例
- ueditor自定义上传附件方法
- jqGrid的分页
- Linux如何安装爱壁纸HD
- Drawable资源
- Andriod之Adapter的getViewTypeCount和getItemViewType为Listview的item设置不同的布局
- Git Reference---Example
- 邮票
- 解决OTA差分包权限丢失的情况