`

applicationContext-common.xml

阅读更多
<?xml version="1.0" encoding="GBK"?>
<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:tx="http://www.springframework.org/schema/tx"
	     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
	<!-- 配置sessionFactory -->
	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="configLocation">
			<value>classpath:hibernate.cfg.xml</value>
		</property>	
	</bean>           
	
	<!-- 配置事务管理器 -->
	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref bean="sessionFactory"/>
		</property>	
	</bean>
	
	<!-- 配置事务的传播特性 -->
	<tx:advice id="txAdvice" transaction-manager="transactionManager">
		<tx:attributes>
			<tx:method name="add*" propagation="REQUIRED"/>
			<tx:method name="del*" propagation="REQUIRED"/>
			<tx:method name="modify*" propagation="REQUIRED"/>
			<tx:method name="*" read-only="true"/>
		</tx:attributes>
	</tx:advice>
	
	<!-- 那些类的哪些方法参与事务 -->
	<aop:config>
		<aop:pointcut id="allManagerMethod" expression="execution(* ssh.dao.*.*(..))"/>
		<aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/>
	</aop:config>
	
	</beans>

 applicationContext-action.xml

<?xml version="1.0" encoding="GBK"?>
<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:tx="http://www.springframework.org/schema/tx"
	     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">


	

	<bean id="objectDao" class="ssh.dao.ObjectDaoImpl">
		<property name="sessionFactory" ref="sessionFactory"/>
	</bean>
	
	<bean id="objectService" class="ssh.service.ObjectServiceImpl">
		<property name="objectDao" ref="objectDao"/>
	</bean>
	
	
	<bean id="User" class="ssh.web.action.UserInfoAction">
		<property name="OAService" ref="objectService"/>
	</bean>
</xml>	

 

分享到:
评论

相关推荐

    ssh框架搭建

    Spring的配置通常分为多个文件,如`applicationContext-action.xml`、`applicationContext-service.xml`、`applicationContext-dao.xml`和`applicationContext-common.xml`,分别对应Action层、Service层、DAO层和...

    Struts2+Spring3+MyBatis3完整实例

    - Loading XML bean definitions from file [E:\Eclipse_C\workspace\MyStrutsTest\WebRoot\WEB-INF\classes\applicationContext-common.xml] - JSR-330 'javax.inject.Inject' annotation found and supported for ...

    spring_aop麻雀

    在`applicationContext-common.xml`和`applicationContext-beans.xml`配置文件中,我们会看到有关AOP的配置,包括定义切面、通知(Advice)、切入点表达式(Pointcut)等。 2. **Spring整合Hibernate**:Spring提供...

    SHH简单集成示例

    2、applicationContext-common.xml对dataSource修改为你的url,username,password. 3、在com.ssh.test中右键junit test 运行向数据库中自动建表,录入数据  4、部署该项目到tomcat.  5、启动tomcat,在浏览器输入...

    Struts2_spring整合

    - 使用 `&lt;import&gt;` 标签引入其他的 Spring 配置文件,如 `applicationContext-common.xml`、`applicationContext-action.xml` 和 `applicationContext-dao.xml`。 #### 三、深入理解整合过程 完成上述步骤后,...

    ExtJS 2.2图书管理系统源码(mysql版)

    使用struts2(json-plugin) + spring2 + ibatis2 + extjs2.2 + mysql5.0架构开发的图书管理系统,对学习struts2,json-plugin,spring2,ibatis2, ...* 部署时,注意修改相应的数据源配置applicationContext-common.xml

    ExtJS 2.2 制作的图书管理系统

    ExtJS 2.2 图书管理系统 注意:工程采用MyEclipse5.1+tomcat5.5 。 1.您的MSSQL2000没有打sp4补丁,会提示拒绝链接(refuse connction) ...4.记住要修改ApplicationContext-common.xml中的数据库用户名和密码:

    SSH_Configurations

    `applicationContext-common.xml`和`applicationContext-beans.xml`都是Spring的配置文件,用来定义Bean的实例化、依赖注入和生命周期管理。前者可能包含了通用的服务或工具类,而后者可能专注于业务逻辑层的Bean...

    spring-boot-reference.pdf

    15.2. Importing XML Configuration 16. Auto-configuration 16.1. Gradually Replacing Auto-configuration 16.2. Disabling Specific Auto-configuration Classes 17. Spring Beans and Dependency Injection 18. ...

    ExtJS 2.2,图书管理系统 (Struts2+spring2+ibatis2+extjs2)

    注意:工程采用MyEclipse5.1+tomcat5.5 。...4.记住要修改ApplicationContext-common.xml中的数据库用户名和密码:) 5.如果还有问题,讨论Q_群:62150370(群1) 76202406(群2) 91986229(群3) 一起讨论

    详细错误提示

    日志显示,Spring根WebApplicationContext正在初始化,加载了多个XML配置文件,如`applicationContext-actions.xml`、`applicationContext-beans.xml`和`applicationContext-common.xml`。这表明Spring框架正在加载...

    Struts2 Spring2.5 Hibernate3.2 框架整合所有XML文件

    `applicationContext-common.xml`可能包含一些通用的、跨模块的配置,比如数据源、事务管理器等。例如: ```xml &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"&gt; ...

    Struts+Spring+Hibernate补充内容

    在`applicationContext-common.xml`中配置Hibernate的SessionFactory: ```xml &lt;bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt; &lt;value&gt;classpath:hibernate...

    北大青鸟学士后第三单元OA办公自动化管理系统

    hibernate.cfg.xml 是hibernate配置信息和Spring的配置分开配置再通过classpath 导入给applicationContext.xml(这两个文件本身已经没使用到了) 项目现在hibernate配置信息都写在了applicationContext-common.xml中 ...

    mybatis+springmvc配置

    第四步:配置applicationContext-common.xml 此文件通常用来配置通用的服务层、数据访问层(DAO)等Bean,例如数据源、事务管理器、Mybatis的SqlSessionFactory等。 第五步:SqlMapper SqlMapper是Mybatis中的XML...

    基于annotation 的ssh整合(2)

    在本案例中,我们将创建一个名为`applicationContext-common.xml`的配置文件,用于管理Spring中的Bean和配置事务管理器。 ```xml &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns="http://www.spring...

    SSMTmall-master.zip

    2. **配置文件**:项目中会有XML配置文件,如`src/main/resources`下的`applicationContext.xml`,`mybatis-config.xml`,用于配置Spring和MyBatis的上下文。此外,还有数据库连接、服务器配置等其他配置文件。 3. ...

    Spring配置

    - `applicationContext-common.xml`可能是共享的公共配置。 7. **Spring框架的扩展性** Spring框架允许通过扩展点进行自定义配置,比如自定义`BeanPostProcessor`、`InstantiationAwareBeanPostProcessor`等,以...

    一个支持annotation的SSH整合示例项目

    卷 (USB)Project 的文件夹 PATH 列表 卷序列号码为 0006EE44 CCBE:F425 ... │ │ │ applicationContext.xml │ │ │ GEDA Checkstyle.xml │ │ │ gedaAppVersion.properties │ │ │ log4j.properties │ ...

Global site tag (gtag.js) - Google Analytics