버전 2 (anonymous에 의해 수정됨, 14 년전)
--

=== anyframe

--context-annotaion.xml

<?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"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

	<!--AOP(Aspect Oriented Programming)-->
	<aop:aspectj-autoproxy />

	<!--Bean Definition-->
	<context:component-scan base-package="com.everland"
		use-default-filters="false">
		<context:include-filter type="annotation"
			expression="org.springframework.stereotype.Service" />
		<context:include-filter type="annotation"
			expression="org.springframework.stereotype.Repository" />
	</context:component-scan>

</beans>

--context-transaction.xml

<?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:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
						http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
						http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
						http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
						
	<util:properties id="contextProperties" location="classpath:context.properties"/>
  	
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="#{contextProperties.driver}"/>
        <property name="url" value="#{contextProperties.url}"/>
        <property name="username" value="#{contextProperties.username}"/>
        <property name="password" value="#{contextProperties.password}"/>
    </bean>							
	
	<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
	  <property name="dataSource" ref="dataSource"/>
	</bean>

	<tx:annotation-driven transaction-manager="txManager" />
	
	<tx:advice id="txAdvice" transaction-manager="txManager">
		<tx:attributes>
			<tx:method name="*" rollback-for="Exception" propagation="REQUIRED"/>
		</tx:attributes>
	</tx:advice>
    
	<aop:config>
		<aop:pointcut id="mipServiceRequiredTx" expression="execution(* *..MiPService.*(..))"/>
		<aop:pointcut id="dynamicHibernateRequiredTx" expression="execution(* *..*DynamicHibernateService.*(..))"/>
		<aop:pointcut id="jobRequiredTx" expression="execution(* *..job..*Job.execute(..))"/>
		<aop:pointcut id="flexRequiredTx" expression="execution(* *..FlexService.*(..))"/>
		<aop:advisor advice-ref="txAdvice" order="2" pointcut-ref="flexRequiredTx" />
		<aop:advisor advice-ref="txAdvice" order="2" pointcut-ref="mipServiceRequiredTx" />
		<aop:advisor advice-ref="txAdvice" order="2" pointcut-ref="dynamicHibernateRequiredTx" />
		<aop:advisor advice-ref="txAdvice" order="2" pointcut-ref="jobRequiredTx" />
	</aop:config>	
</beans>