I'm experiencing a circular dependency error when mixing XML & Java Config.
Can anyone shed some lights on how to properly configure Spring w/ mix XML & Java Config or if possible go Java Config all the way?
Here is the code snippet:
Code:@Configuration @ImportResource({ "classpath:/logging-ctx.xml" }) public class LoggingConfig { /** * @return methodInterceptor */ @Bean(autowire=Autowire.BY_TYPE) public MethodInterceptor traceInterceptor() { CustomizableTraceInterceptor interceptor = new CustomizableTraceInterceptor(); interceptor.setEnterMessage("Entering $[methodName]($[arguments])"); interceptor.setExitMessage("Leaving $[methodName]: $[returnValue] : running time $[invocationTime]ms"); interceptor.setUseDynamicLogger(true); return interceptor; } }Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd"> <aop:config> <aop:advisor advice-ref="traceInterceptor" pointcut="execution(* x.y..*.*(..))"/> </aop:config> </beans>


Reply With Quote