`

spring applicationcontext配置

    博客分类:
  • ssh
阅读更多
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
	<!-- DataSource Configurer -->
	<!--PropertyPlaceholderConfigurer实现了BeanFactoryPostProcessor,将配置信息配置在property文件中  -->
	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="/WEB-INF/system-config.properties" />
	</bean>

	<!-- C3P0 DataSource -->

	<bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource"
		lazy-init="false">
		<property name="driver">
			<value>${jdbc.driverClassName}</value>
		</property>
		<property name="driverUrl">
			<value>${jdbc.url}</value>
		</property>
		<property name="user">
			<value>${jdbc.username}</value>
		</property>
		<property name="password">
			<value>${jdbc.password}</value>
		</property>
		<property name="maximumConnectionCount">
			<value>${jdbc.maximumConnectionCount}</value>
		</property>
		<!-- 
		<property name="houseKeepingSleepTime">
			<value>${jdbc.houseKeepingSleepTime}</value>
		</property>
		 -->
		<property name="houseKeepingTestSql">
			<value>${jdbc.houseKeepingTestSql}</value>
		</property>
		<property name="testBeforeUse">
			<value>${jdbc.testBeforeUse}</value>
		</property>
		<property name="alias">
			<value>${jdbc.alias}</value>
		</property>
		<property name="simultaneousBuildThrottle">
			<value>${jdbc.simultaneousBuildThrottle}</value>
		</property>
		<property name="trace">
			<value>${jdbc.trace}</value>
		</property>
	</bean>


	<!--
		Hibernate SessionFactory Automatically validate or export schema DDL
		to the database when the SessionFactory is created. With create-drop,
		the database schema will be dropped when the SessionFactory is closed
		explicitly. eg. validate | update | create | create-drop <prop
		key="hibernate.hbm2ddl.auto">update</prop>
	-->
	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="mappingResources">
			<!-- 设置与表格的映射文件 -->
			<value>
				com/jsict/gcfm/vo/TArea.hbm.xml,
				com/jsict/gcfm/vo/TDepart.hbm.xml,
				com/jsict/gcfm/vo/TMatGoodsList.hbm.xml,
				com/jsict/gcfm/vo/TMatticket.hbm.xml,
				com/jsict/gcfm/vo/TMbrTerList.hbm.xml,
				com/jsict/gcfm/vo/TMember.hbm.xml,
				com/jsict/gcfm/vo/TMessage.hbm.xml,
				com/jsict/gcfm/vo/TPhoto.hbm.xml,
				com/jsict/gcfm/vo/TPresent.hbm.xml,
				com/jsict/gcfm/vo/TProduct.hbm.xml,
				com/jsict/gcfm/vo/TrBigdategoods.hbm.xml,
				com/jsict/gcfm/vo/TrCompetitioninfo.hbm.xml,
				com/jsict/gcfm/vo/TrMaterial.hbm.xml,
				com/jsict/gcfm/vo/TrOrder.hbm.xml,
				com/jsict/gcfm/vo/TrOrdGoodsList.hbm.xml,
				com/jsict/gcfm/vo/TrReturngoods.hbm.xml,
				com/jsict/gcfm/vo/TrRtnGoodsList.hbm.xml,
				com/jsict/gcfm/vo/TrSaleAll.hbm.xml,
				com/jsict/gcfm/vo/TrSaleSingle.hbm.xml,
				com/jsict/gcfm/vo/TrStock.hbm.xml,
				com/jsict/gcfm/vo/TTerminal.hbm.xml,
				com/jsict/gcfm/vo/TOperatelog.hbm.xml,
				com/jsict/gcfm/vo/TMessageStatus.hbm.xml,
				com/jsict/gcfm/vo/TSystem.hbm.xml
			</value>

		</property>
		<property name="hibernateProperties">
			<!-- hibernate 配置的属性 -->
			<props>
				<prop key="hibernate.dialect">
					${hibernate.dialect}
				</prop>
				<prop key="hibernate.show_sql">false</prop>
				<prop key="hibernate.generate_statistics">true</prop>
				<prop key="hibernate.connection.autocommit">false</prop>
				<prop key="hibernate.connection.release_mode">after_statement</prop>
				<prop key="hibernate.cache.use_second_level_cache">false</prop>
				<prop key="hibernate.max_fetch_depth">15</prop>
			</props>
		</property>
		<property name="eventListeners">
			<map>
				<entry key="merge">
					<bean
						class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
				</entry>
			</map>
		</property>
	</bean>

	<!-- hibernate 事务管理器 -->
	<bean id="transactionManager"
		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
	<!-- hibernate 申明式事务管理配置 -->
	<bean id="transactionInterceptor"
		class="org.springframework.transaction.interceptor.TransactionInterceptor">
		<property name="transactionManager" ref="transactionManager" />
		<property name="transactionAttributeSource">
			<value>
				<!--
					com.jsict.gcfm.demo.TestAction.find*=PROPAGATION_REQUIRED,ISOLATION_DEFAULT,-ESPException,-RuntimeException
				-->
				com.jsict.gcfm.goodsmgr.ordermanage.OrderManageService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.goodsmgr.ordermanage.OrderManageService.saveOrder=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.goodsmgr.returnedgoods.ReturnedGoodsService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.goodsmgr.returnedgoods.ReturnedGoodsService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.goodsmgr.ordersummarize.OrderSummarizeService.upload*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.terminal.notic.NoticMessageService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.terminal.TerminalService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.terminal.TerminalService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.terminal.TerminalService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.employee.EmployeeService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.employee.EmployeeService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.employee.EmployeeService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.product.ProductService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.product.ProductService.search*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.product.ProductService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.product.ProductService.find*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.product.ProductService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.present.PresentService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.present.PresentService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.present.PresentService.search*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.present.PresentService.find*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.basicinfo.present.PresentService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleSingleService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleSingleService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleSingleService.search*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleSingleService.find*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleSingleService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleAllService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleAllService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleAllService.search*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleAllService.find*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.salesvolume.SaleAllService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.material.MaterialService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.material.MaterialService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.material.MaterialService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.material.MaterialService.search*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.material.MaterialService.find*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.search*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.datalist.competitiveinfo.CompetitiveinfoService.find*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.goodsmgr.stock.StockService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.goodsmgr.stock.StockService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.goodsmgr.stock.StockService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.goodsmgr.stock.StockService.search*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.goodsmgr.stock.StockService.find*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.create*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.delete*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.update*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.search*=PROPAGATION_REQUIRED,-gcfmException
				com.jsict.gcfm.terminal.photosmanage.PhotosmanageService.find*=PROPAGATION_REQUIRED,-gcfmException
				
			</value>
		</property>
	</bean>

	<bean
		class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator">
		<property name="interceptorNames">
			<list>
				<value>transactionInterceptor</value>
			</list>
		</property>
	</bean>

	<bean
		class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor">
		<property name="transactionInterceptor" ref="transactionInterceptor" />
	</bean>

	<!-- Hibernate 3.0's JMX statistics service -->
	<!-- Implements the StatisticsServiceMBean management interface -->
	<bean name="broadengate:type=HibernateStatistics" class="org.hibernate.jmx.StatisticsService">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>

	<bean id="baseAction" abstract="true" class="com.jsict.gcfm.BaseAction"
		init-method="init">
		<!--
			可以初始化所有action公用的内容 <property name="logService" ref="logService" />
		-->
		<property name="pageSize">
			<value>${pagemax}</value>
		</property>
		<property name="productService" ref="productService" />
		<property name="employeeService" ref="employeeService" />
		<property name="terminalService" ref="terminalService" />
		<property name="departmentService" ref="departmentService" />
		<property name="areaService" ref="areaService" />
	</bean>


	<import resource="/spring/applicationContext-competitiveinfo.xml" />
	<import resource="/spring/applicationContext-photosmanage.xml" />
	<import resource="/spring/applicationContext-salesvolume.xml" />
	<import resource="/spring/applicationContext-present.xml" />
	<import resource="/spring/applicationContext-product.xml" />
	<import resource="/spring/applicationContext-ordermanage.xml" />
	<import resource="/spring/applicationContext-ordersummarize.xml" />
	<import resource="/spring/applicationContext-orderreach.xml" />
	<import resource="/spring/applicationContext-returnedgoods.xml" />
	<import resource="/spring/applicationContext-returnedsummarize.xml" />
	<import resource="/spring/applicationContext-returnedreply.xml" />
	<import resource="/spring/applicationContext-login.xml" />
	
	<import resource="/spring/applicationContext-logdb.xml" />
	
	<import resource="/spring/applicationContext-noticmessage.xml" />

	<import resource="/spring/applicationContext-material.xml" />

	<import resource="/spring/applicationContext-area.xml" />
	<import resource="/spring/applicationContext-department.xml" />
	<import resource="/spring/applicationContext-employee.xml" />
	<import resource="/spring/applicationContext-terminal.xml" />
	<import resource="/spring/applicationContext-system.xml" />
	<import resource="/spring/applicationContext-stock.xml" />
</beans>
分享到:
评论

相关推荐

    spring applicationContext.xml详细配置

    在Spring框架中,`applicationContext.xml`是核心配置文件,用于定义bean的声明、依赖注入、数据源配置、事务管理等。在这个配置文件中,我们可以深入理解Spring如何管理和协调应用程序的各个组件。以下是对`...

    Spring中ApplicationContext加载机制

    Spring中ApplicationContext加载机制 ApplicationContext 是 Spring 框架中的核心组件之一,负责...Spring 中的 ApplicationContext 加载机制提供了多种选择和灵活的配置方式,方便了开发者快速构建和管理应用程序。

    Spring ApplicationContext.xml配置的12个技巧演示教学.pdf

    "Spring ApplicationContext.xml配置的12个技巧演示教学" Spring ApplicationContext.xml配置是 Spring 框架中非常重要的一部分,它提供了企业级服务,并且可以通过依赖注入来获得简单而有效的测试能力。然而,在...

    Spring中ApplicationContext和beanfactory区别.rar

    在Spring框架中,ApplicationContext和BeanFactory是两种不同的bean容器,它们各自有其特性和应用场景,理解二者的区别对于深入学习和使用Spring至关重要。 首先,BeanFactory是Spring中最基础的bean管理容器,它...

    Spring获取ApplicationContext对象工具类的实现方法

    在Spring中,ApplicationContext(应用程序上下文)是容器的核心,负责配置和管理应用中对象的生命周期和依赖关系。在实际开发过程中,经常需要从各个角落获取到这个ApplicationContext对象,以便于能够使用Spring...

    spring2.5的applicationContext配置文件

    在Spring框架中,`applicationContext.xml`是核心的配置文件,它定义了bean的实例化、依赖注入、服务的装配以及整个应用上下文的行为。在Spring 2.5版本中,这个配置文件引入了许多增强的功能,提升了开发效率和灵活...

    《Spring的数据源配置文件模板》applicationContext.zip

    `applicationContext.xml`是Spring应用上下文配置文件,通常用于定义bean的声明、依赖注入以及数据源的相关配置。本文件模板将详细介绍如何在Spring中配置数据源,以便为你的应用程序提供稳定、高效的数据库连接。 ...

    详解spring applicationContext.xml 配置文件

    在Spring框架中,`applicationContext.xml`是核心的配置文件,它定义了应用上下文,即Spring容器,用来管理所有bean的创建、初始化、依赖注入以及生命周期。这个文件使用XML语法,遵循特定的命名空间和schema,以...

    Spring配置文件ApplicationContext

    Spring配置文件ApplicationContext,内容齐全,有需要的可以下载。

    spring+jpa的applicationContext.xml配置

    spring+jpa的applicationContext.xml配置

    Spring 2.5-applicationContext.xml提示信息的配置

    在Spring框架中,`applicationContext.xml`是应用上下文的核心配置文件,用于定义bean的创建、依赖关系以及各种服务的配置。这篇博文“Spring 2.5 - applicationContext.xml提示信息的配置”主要探讨了如何在Spring ...

    Spring MVC开发配置文件 applicationContext

    Spring Web MVC开发 xml配置文件格式,无bean之类 Spring Web MVC开发配置文件 applicationContext

    spring为ApplicationContext提供的3种实现分别为:ClassPathXmlApplicationContext

    在处理"档案管理.txt"这个文件时,如果是Spring配置相关的文本,可能包含了bean的定义或者一些自定义的配置,通过分析这些内容可以进一步了解Spring如何管理和使用这些配置来构建应用上下文。如果文件内容并非与...

    三、Spring源码分析——ApplicationContext

    ApplicationContext还支持Bean的懒加载、单例或多例管理、Profile功能(根据环境选择加载不同的配置)、以及与其他Spring模块(如Spring Data、Spring Security等)的集成。 总的来说,ApplicationContext作为...

    struts2+hibernate+spring

    - **Spring ApplicationContext配置**:定义了Spring配置文件的位置,通常这些文件会定义Spring中的Bean。 - **字符编码过滤器**:用于确保所有的请求和响应都使用UTF-8编码,避免中文乱码问题。 - **Hibernate ...

    spring 获得applicationcontext公用方法

    在Spring框架中,`ApplicationContext`是一个非常重要的接口,它提供了加载和管理Bean定义,以及获取Bean实例的功能。本文将深入探讨如何在Spring中获取`ApplicationContext`的公用方法,并结合提供的两个文件名`...

    Eclipse spring基本配置步骤

    1. 在项目的src目录下,新建一个名为`applicationContext.xml`的XML文件,这是Spring的主要配置文件。 **步骤4:配置Bean** 在`applicationContext.xml`中,定义Bean的基本结构。例如,创建一个简单的HelloWorld类...

    Spring动态加载配置文件

    通常,我们将Spring的配置文件(如`applicationContext.xml`)放在项目的类路径下,如`src/main/resources`目录。确保配置文件的位置在项目构建后不会变动,以便于后续的监听和加载。 其次,我们需要创建一个监听类...

    spring的Applicationcontext对事件的监听,实现类似MQ的效果

    在Spring配置中,监听器会被自动扫描并注册到`ApplicationContext`。一旦事件被发布,所有注册的监听器都会接收到该事件。发布事件可以通过`ApplicationContext`的`publishEvent`方法完成: ```java @Autowired ...

    spring配置文件加密实现

    Spring的配置文件通常为XML格式,如`applicationContext.xml`,它包含了bean的定义、属性值以及依赖关系等。这些数据在未加密状态下可能存在安全风险。 加密Spring配置文件的第一步是选择一个合适的加密算法。常见...

Global site tag (gtag.js) - Google Analytics