Hi everyone

I've just committed experimental AspectJ support to CVS HEAD, which is documented in the reference guide. The key benefit is domain object instances can be created outside the bean container and still receive full security interception.

Refactoring of the AOP Alliance (MethodSecurityInterceptor) and the ObjectDefinitionSource has also been completed to make it easier to support additional AOP libraries like AspectWerks in the future (is there demand for AspectWerks at present?).

On a "rich domain object" related note, I've written an AspectJ aspect to autowire domain objects with collaborators from a Spring bean context. Whilst nothing too exciting, it does the same thing as the DependencyInjectionInterceptorFactoryBean discussed at http://forum.springframework.org/viewtopic.php?t=301, except it doesn't require a Hibernate interceptor (meaning even "new SomeDomainObject();" instances are wired). In case anyone is interested, the code follows.

Any feedback etc welcome.

Cheers
Ben

---------------


public aspect DomainObjectInstanceDependencyInjectionAspect implements BeanFactoryAware {


private AutowireCapableBeanFactory acbf;
private int autowireMode = AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE;
public int getAutowireMode() {
return autowireMode;
}
public void setAutowireMode(int autowireMode) {
if (autowireMode != AutowireCapableBeanFactory.AUTOWIRE_BY_NAME && autowireMode != AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE)
throw new IllegalArgumentException("Can only AUTOWIRE_BY_NAME or AUTOWIRE_BY_TYPE");
this.autowireMode = autowireMode;
}
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
if (!(beanFactory instanceof AutowireCapableBeanFactory))
throw new IllegalArgumentException("BeanFactory must implement AutowireCapableBeanFactory");
acbf = (AutowireCapableBeanFactory) beanFactory;
}
pointcut domainObjectInstanceConstruction(Object doi): target(doi) && execution(PersistableEntity.new(..));
before(Object doi): domainObjectInstanceConstruction(doi) {
if (acbf != null)
acbf.autowireBeanProperties(doi, autowireMode, false);
}
}





------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Acegisecurity-developer mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to