<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:annotation-config />
<context:component-scan base-package="com.lan" /> <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:jdbc.properties</value>
</property>
</bean> <bean id="dataSource" destroy-method="close"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean> <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<!--
<property name="annotatedClasses">
<list>
<value>com.bjsxt.model.User</value>
<value>com.bjsxt.model.Log</value>
</list>
</property>
-->
<property name="packagesToScan">
<list>
<value>com.lan.registration.model</value> </list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean> <bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <aop:config>
<aop:pointcut id="bussinessService"
expression="execution(public * com.bjsxt.registration.service.*.*(..))" />
<aop:advisor pointcut-ref="bussinessService"
advice-ref="txAdvice" />
</aop:config> <tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="exists" read-only="true" />
<tx:method name="add*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice> </beans>

Spring beans.xml的更多相关文章

  1. [转]spring beans.xml

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  2. 利用beans.xml进行简单的Spring应用上下文创建与使用

    继上次配置Spring完成后,我们来创建一个简单的例程来理解Spring中利用beans.xml创建应用上下文的方法. 程序路径包为:com.spring.kinghts(kinght单词拼写错误,怕 ...

  3. Spring配置文件的加载,及装载多个beans.xml文件

    applicationContext.xml 是spring的全局配置文件,用来控制srping的特性 1  手动加载自定义的beans.xml文件 @Test public void testAut ...

  4. spring入门:beans.xml不提示、别名、创建对象的三种方式

    spring的版本是2.5 一.beans.xml文件不提示 Location:spring-framework-2.5.6.SEC01\dist\resources\spring-beans-2.5 ...

  5. Spring配置文件beans.xml头部配置解释

    Spring配置文件beans.xml头部配置解释 - EasonJim - 博客园https://www.cnblogs.com/EasonJim/p/6880329.html

  6. 自定义beans.xml文件实现Spring框架

    经过一天的补习,学习文件加载,java反射,JDom等知识,到了晚上终于能够搭出一个基于配置文件的简单spring框架实现! 首先我们先看看这个问题: 下面是两副图左边是项目结构图,右边是UML图: ...

  7. spring框架中beans.xml文件报错XmlBeanDefinitionStoreException

    第一次构建spring,实现简单的注入方式,就发生了beans.xml文件报错,报错信息如下图 org.springframework.beans.factory.xml.XmlBeanDefinit ...

  8. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [spring/applicationContext-service.xml]: Cannot resolve refer

    <!-- aop --> <aop:config> <aop:pointcut expression="execution(* com.zsn.Service. ...

  9. Spring框架配置beans.xml扩展

    Spring学习笔记(二) 续Spring 学习笔记(一)之后,对Spring框架XML的操作进行整理 1 什么是IOC(DI) IOC = inversion of control   控制反转 D ...

随机推荐

  1. perl中设置POST登录时的重定向

    默认地, perl提交post登录时是不会重定向的 要让它重定向, 可以用如下方法: my $cookie = HTTP::Cookies->new(); push @{$ua->requ ...

  2. css 背景透明,文字不透明

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  3. peewee外键性能问题

    # 转载自:https://www.cnblogs.com/miaojiyao/articles/5217757.html 下面讨论一下用peewee的些许提高性能的方法. 避免N+1查询 N+1查询 ...

  4. 【bzoj4551】TJOI2016&HEOI2016树

    这题嘛…… 子树询问什么的,直接dfs序线段树无脑写,是吧…… 然后几分钟之内zcy就写出了这样的东西: #include<bits/stdc++.h> #define N 100005 ...

  5. JS监控手机或APP返回事件

    做微信项目的时候,发现在Ios微信浏览器左上角有个返回按钮,但是点击返回时不稳定,跳到不该跳的页面.网上搜了一个捕获返回事件的JS代码,记录下来,便于以后查看. <span style=&quo ...

  6. 关于时间日期的一些操作--java

    # 原创,转载请留言联系 1.获取当前时间 public static void main(String[] args) { Date d1 = new Date(); System.out.prin ...

  7. 175. Combine Two Tables

    Table: Person +-------------+---------+ | Column Name | Type | +-------------+---------+ | PersonId ...

  8. Vue.js—组件快速入门及Vue路由实例应用

    上次我们学习了Vue.js的基础,并且通过综合的小实例进一步的熟悉了Vue.js的基础应用.今天我们就继续讲讲Vue.js的组件,更加深入的了解Vue,js的使用.首先我们先了解一下什么是Vue.js ...

  9. 通过url判断当前页,动态给导航加样式

    //通过url判断当前页,动态给导航加样式 var str =location.pathname; var index = str.lastIndexOf("\/"); str = ...

  10. hdu 多校第一场

    1001 思路:打表可以发现只有3|n 和 4|n 的情况有解,判一下就好啦. #include<bits/stdc++.h> #define LL long long #define f ...