<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="summer_hello" class="summer.Hello">
<property name="hello">
<value>Hello World</value>
</property>
</bean>
</beans>
package summer;
public class Hello
  {
private String hello;

public String getHello()
 {
return hello;
}

public void setHello(String hello)
 {
this.hello = hello;
}
}

package summer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class Main
  {

public static void main(String[] args)
 {
ApplicationContext ctx = new FileSystemXmlApplicationContext("src/summer.xml");
Hello h=(Hello)ctx.getBean("summer_hello");
System.out.print(h.getHello());
}

} |