There is another way. You still need to download the usual AspectJ installer and the eclipse AJDT. Then create an aspectj project with a class like the code below.
package com.mobileindie.spring.utils;
import org.springframework.beans.factory.aspectj.AbstractBeanConfigurerAspect;
import org.springframework.beans.factory.wiring.ClassNameBeanWiringInfoResolver;
public aspect DomainObjectConfiguration extends AbstractBeanConfigurerAspect {
public DomainObjectConfiguration() {
setBeanWiringInfoResolver(new ClassNameBeanWiringInfoResolver());
}
// the creation of a new bean (any object in the domain model)
protected pointcut beanCreation(Object beanInstance) :
initialization(com.mobileindie.domains..new(..)) &&
this(beanInstance);
}
Take note of the initialization line, this is where you define which objects you would like to inject your dependencies whenever a new instance is called. This also assumes wire by prototype mode. But the beans are configured just like a normal bean in your spring application context xml.
devnox
- ano nga ba ang aspect kung meron kang aspect?
No comments:
Post a Comment