2

As per this question, it seems that you can declare something like the following and have it "work":

@Configurable(autowire=Autowire.BY_TYPE)
public class Target {

    private List<Dependency> dependencies;

    public List<Dependency> getDependencies() {
        return this.dependencies;
    }

    @Autowired
    public void setDependencies(List<Dependency> dependencies) {
        this.dependencies = dependencies;
    }
}

Application context:

<beans>
    <!-- where all extend Dependency -->
    <bean class="com.dependencies.SubDependency"/>
    <bean class="com.dependencies.SubSubDependency"/>
</beans>

According to the manual, this should "just work™", but it doesn't. Other dependenices are wired on Target but the list dependency isn't. Is there something I'm doing wrong? I only have one dependency at the moment to be wired, but this will expand with time.

Community
  • 1
  • 1
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411

1 Answers1

1

I've got an example of doing this with build-time weaving on github. If it's not a problem with your weaver, maybe you can identify the problem by comparison. You can browse it or clone and run it:

git clone git://github.com/zzantozz/testbed.git tmp
cd tmp
mvn -q compile exec:java -Dexec.mainClass=rds.spring.SpringConfigurable \
    -pl spring-aspectj-build-time-weaving
Ryan Stewart
  • 126,015
  • 21
  • 180
  • 199