Interesting!
beans.xml
BarImpl.java
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:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd"> <bean id="bar" class="biz.tugay.spashe.BarImpl"/> <aop:config> <aop:advisor pointcut="execution(void biz.tugay.spashe.Foo.foo())" advice-ref="bar"/> </aop:config> <bean id="foo" class="biz.tugay.spashe.FooImpl"/> </beans>
BarImpl.java
package biz.tugay.spashe; import org.springframework.aop.MethodBeforeAdvice; import java.lang.reflect.Method; /** * User: Koray Tugay (koray@tugay.biz) * Date: 26/10/2017 */ public class BarImpl implements MethodBeforeAdvice { @Override public void before(Method method, Object[] objects, Object o) throws Throwable { System.out.println("BarImpl#bar"); } }I do not know why
<aop:aspectj-autoproxy/>
is not required!