************MyAspect.java************* package com.mkyong.aspect; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; @Aspect public class MyAspect { @Before("checkMyDetails()") public void myLogging() throws Throwable { System.out.println("Logger added successfully"); } @Pointcut("within(com.mkyong.customer.bo.*)") public void checkMyDetails() {} } ********************************************************** MyTest.java package com.mkyong.customer.bo; public interface MyTest { void addMe(String s); } ******************************************************* MyTestImpl.java package com.mkyong.customer.bo.impl; import com.mkyong.customer.bo.MyTest; public class MyTestImpl implements MyTest { public void addMe(String s) { System.out.println("I had added the " + s + " person"); } } ********************************************************************************* Spring-Customer.xml *************************************************************************************** App.java package com.mkyong.core; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.mkyong.customer.bo.MyTest; public class App { public static void main(String[] args) throws Exception { ApplicationContext appContext = new ClassPathXmlApplicationContext("common-files.xml"); MyTest testing = (MyTest) appContext.getBean("testBo"); testing.addMe("Srinu"); } }