Hello to all.
I've the following problem. I've a ConfigurableRowMapper class that I want to make @Configurable.
I marked it with the annotation and I put a protected field in it annotated with the @Resource (or @Autowired, the result is the same) annotation, like this:
The application context is configured like this:@Configurable
public class PropertyRowMapper implements ParameterizedRowMapper<Property>
{
@Resource(name = "lobHandler")
protected LobHandler lobHandler;
// Do something....
}
I use compile time weaving using the aspectj maven plugin with the following dependencies:<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
default-autowire="byName">
<context:component-scan base-package="..." />
<context:spring-configured />
<bean id="lobHandler" class="org.springframework.jdbc.support.lob.Defaul tLobHandler" />
</beans>
- spring-aspects-2.5.6.jar
- aspectjrt-1.6.1.jar
- aspectjweaver-1.6.1.jar
- aspectjtools-1.6.1.jar
Compilation ends correctly and using showWeaveInfo the output is the following:
Now the problem is that, when running tests, the PropertyRowMapper class is not injected with the LobHandler declared in the application context....
22/12/08 11.15.41 CET: [INFO] Join point 'initialization(void com.cedac.commons.propertyset.impl.PropertyRowMapp er.<init>())' in Type 'com.cedac.commons.propertyset.impl.PropertyRowMap per' (PropertyRowMapper.java:35) advised by afterReturning advice from 'org.springframework.beans.factory.aspectj.Annotat ionBeanConfigurerAspect' (spring-aspects-2.5.6.jar!AbstractDependencyInjectionAspect.class: 87(from AbstractDependencyInjectionAspect.aj)) [with runtime test]
...
I've tried different approaches to this problem but none of them seems to work.
I've also noticed that Eclipse AJDT plugin doesn't annotate the code line with his marker (usually this happens).
In the first I've suspected an Eclipse problem, but running tests from command line produce the same results.
There is someone that can help me?
This problem is driving me crazy.
Thank you.
Mauro


Reply With Quote