파일 시스템 어플리케이션
j0412_2 Hello3.java
package j0412_2;
public interface Hello3 {
public String sayHello(String name);
}
j0412_2 Hello3Imple.java
package j0412_2;
public class Hello3Imple implements Hello3{
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String sayHello(String name) {
// TODO Auto-generated method stub
return "입력받은 이름은과 나이는 "+name+" : "+age;
}
}
j0412_2 Hello3Main3.java
package j0412_2;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class HelloMain3 {
public static void main(String[] args){
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:/x0412_2/test3.xml");
Hello3 h3 = (Hello3)ctx.getBean("hellgate");
String a = h3.sayHello("이현재");
System.out.println(a);
System.out.println(h3.sayHello("이현재"));
}
}
x0412_2패키지 test3.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<bean id="hellgate" class="j0412_2.Hello3Imple">
<property name="name"><value>이현재</value></property>
<property name="age"><value>999</value></property>
</bean>
</beans>