<?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:aop="http://www.springframework.org/schema/aop"
	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">

	<!-- The tasklet used in this job will run in an infinite loop.  This is useful for testing graceful shutdown from
		multiple environments. -->

	<bean id="loopJob" parent="simpleJob">
		<property name="steps">
			<bean id="step1" parent="taskletStep">
				<property name="tasklet">
					<bean
						class="org.springframework.batch.sample.tasklet.InfiniteLoopTasklet" />
				</property>
			</bean>
		</property>
	</bean>

	<bean id="logAdvice"
		class="org.springframework.batch.sample.advice.MethodExecutionLogAdvice" />

	<bean id="eventAdvice"
		class="org.springframework.batch.sample.advice.MethodExecutionApplicationEventAdvice" />

	<aop:config>
		<aop:aspect ref="logAdvice">
			<aop:after
				pointcut="execution( * org.springframework.batch.sample..InfiniteLoopTasklet+.execute(..))"
				method="doBasicLogging" />
		</aop:aspect>
		<aop:aspect ref="eventAdvice">
			<aop:before
				pointcut="execution( * org.springframework.batch..Step+.execute(..))"
				method="before" />
			<aop:after
				pointcut="execution( * org.springframework.batch..Step+.execute(..))"
				method="after" />
			<aop:after-throwing throwing="t"
				pointcut="execution( * org.springframework.batch..Step+.execute(..))"
				method="onError" />
		</aop:aspect>
	</aop:config>

</beans>
