Hello is this a way how I can configure aspect witch spring?
I have this aspect:
Aspect is call but propertie ITemplet isn't set and this exception raise:Code:@Aspect @Configurable public class TempletAspect { /** Describe templet here. */ @Autowired @Qualifier("templet") private ITemplet templet; /** Get the <code>Templet</code> value. * @return a value */ public final ITemplet getTemplet() { return templet; } /** Set the <code>Templet</code> value. * @param newTemplet The new Templet value. */ public final void setTemplet(final ITemplet newTemplet) { this.templet = newTemplet; } @Around("target(cz.apnetis.web.INeedTemplet) && call(* *.getTemplet())") public final Object setTempletToController(final ProceedingJoinPoint thisJoinPoint) { System.out.println("ASPECT IS CALLL --------------------"); return getTemplet(); } }
But I have templet which implements ITemplet in my spring context.Code:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cz.apnetis.web.support.TempletAspect': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private cz.apnetis.web.ITemplet cz.apnetis.web.support.TempletAspect.templet; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [cz.apnetis.web.ITemplet] is defined: Unsatisfied dependency of type [interface cz.apnetis.web.ITemplet]: expected at least 1 matching bean
Its there a way to mixing AspectJ and Spring in one aspect?


Reply With Quote
