Amigos gujeiros, estou fazendo meu TCC sobre Aspectos com AspectJ e no meu estudo de caso eu estou utilizando o Spring para utilizar o AspectJ, porém, o problema é que eu não consigo colocar os aspectos para funcionarem. Segue abaixo o que é relevante para a analise de vocês:
spring-beans.xml
<?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"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<aop:aspectj-autoproxy/>
<context:annotation-config />
<context:component-scan base-package="edu.fatec.zl.entity" />
<context:component-scan base-package="edu.fatec.zl.bean" />
<context:component-scan base-package="edu.fatec.zl.aspect" />
</beans>
Aspecto
@Aspect
@Component
public class Logger {
org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(Logger.class);
@After(value="execution(public * edu.fatec.zl.dao.DataAccess.insert())")
public void logException(){
logger.error("<<<<<<<<<<<<<<<<<<Teste>>>>>>>>>>>>>>>>>>>>>");
}
}
[color=red] Mensagem de erro:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [edu.fatec.zl.entity.Ativo] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}
[/color]
Estranha esta mensagem de erro porque se eu tiro o método logException(); a aplicação sobe normal, teria algum problema utilizar AspectJ + Spring + JSF2 ?
Se quiserem pegar o projeto esta no github: https://github.com/ivanzito
Vlw galera e até mais…