THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
The second bean definition is for the client. In this case it implements the HelloWorld interface and is created by the proxyFactory <bean> by calling the create() method. You can then reference this "client" bean and inject it anywhere into your application. Here is an example of a very simple Java class which accesses the client bean:
Code Block | ||||
---|---|---|---|---|
| ||||
include org.springframework.context.support.ClassPathXmlApplicationContext;
public final class HelloWorldClient {
private HelloWorldClient() { }
public static void main(String args[]) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
new String[]{"my/path/to/client-beans.xml"});
HelloWorld client = (HelloWorld)context.getBean("client");
String response = client.sayHi("Dan");
System.out.println("Response: " + response);
System.exit(0);
}
}
|
The ProxyFactoryBean supports many other properties:
...