Hi,
I'm wondering if I can map this piece of xml-configuration to Spring JavaConfig:
So far I figured out how to replace aop:pointcut withCode:<?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" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schem...spring-aop.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-autowire="byName"> <aop:config> <aop:pointcut id="serviceAnnotatedClass" expression="@within(org.springframework.stereotype.Service)" /> <aop:advisor id="managerTx" advice-ref="txAdvice" pointcut-ref="serviceAnnotatedClass" order="20" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="get*" read-only="true" /> <tx:method name="find*" read-only="true" /> <tx:method name="load*" read-only="true" /> <tx:method name="is*" read-only="true" /> <tx:method name="ownTransaction*" propagation="REQUIRES_NEW" rollback-for="Exception" /> <tx:method name="*" rollback-for="Exception" /> </tx:attributes> </tx:advice> </beans>
andCode:<aop:advisor id="managerTx" advice-ref="txAdvice" pointcut="com.myapp.configuration.AspectConfig.serviceAnnotatedClass()" order="20"/>
Any hints how to replace the rest?Code:import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; @Aspect public class AspectConfig { @Pointcut("@within(org.springframework.stereotype.Service)") public void serviceAnnotatedClass() {} }
Jonny


Reply With Quote
