File: BusinessLogic.java
public class BusinessLogic implements IBusinessLogic
{
public void foo()
{
System.out.println("Inside BusinessLogic.foo()");
}
}
File: IBusinessLogic.java
public interface IBusinessLogic
{
public void foo();
}
File: MainApplication.java
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class MainApplication
{
public static void main(String [] args)
{
// Read the configuration file
ApplicationContext ctx
= new FileSystemXmlApplicationContext("build/springconfig.xml");
//Instantiate an object
IBusinessLogic testObject = (IBusinessLogic) ctx.getBean("businesslogicbean");
//Execute the public method of the bean (the test)
testObject.foo();
}
}
File: springconfig.xml
class="org.springframework.aop.framework.ProxyFactoryBean">
IBusinessLogic
class="BusinessLogic"/>