Pessoal, estou apanhando bastante da AOP do Spring 3.
O código do Aspecto não executa... já tentei até deixar a expressão assim: "execution(* *.*(..))" e também não executou...
Alguém tem uma ideia?
public interface Combustivel {
public void injetar() throws SemCombustivelException;
}
public class Alcool implements Combustivel {
private Integer quantidade = 10;
public void injetar() throws SemCombustivelException {
if (quantidade == 0)
throw new SemCombustivelException();
else
quantidade--;
}
}
@Aspect
public class CombustivelAspect {
@Before("execution(* minicurso_spring_aop.interfaces.Combustivel.*(..))")
public void avisar(){
System.out.println("vai injetar");
}
}
<?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: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/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<bean class="minicurso_spring_aop.aspect.CombustivelAspect" />
<aop:aspectj-autoproxy />
</beans>