package springintro.bean;
import java.time.LocalDate;
import java.util.Calendar;
import org.springframework.context.Applicationtext;
import org.springframework.context.supprot.ClassPathXmlApplicationContext;
import springintro.bean.Employee;
import springintro.bean.Product;
import java.time.LocalDate;
import java.util.Calendar;
import org.springframework.context.Applicationtext;
import org.springframework.context.supprot.ClassPathXmlApplicationContext;
import springintro.bean.Employee;
import springintro.bean.Product;
public class Main {
public static void main (String [] args){
ClassPathXmlApplicationContext context=
new ClassPathXmlApplicationContext(new String []{"spring-config.xml"});
Product product1=context.getBean("product",Product.class);
product1. setName("Excellent snake oil");
System.out.println("product1:"+product1.getName());
Product product2=context.getBean("product",Product.class);
System.out.println("product2:"+product2.getName());
Product featuredProduct=context.getBean("featureProduct:"+Product.class);
System.out.println(featuredProduct.getName()+
","+featuredProduct.getDescription()+
","+featuredProduct.getPrice());
LocalDate localDate =context.getBean("localDate",
java.time.LocalDate.class);
System.out.println("today:"+localDate);
Employee employee1=context.getBean("employeel1",Employee.class);
System.out.println(employee1.getFirstName()+" "
+employee1.getLastName());
System.out.println(employee1.getHomeAddress());
Employee employee2=context.getBean("employee2",Employee.class);
System.out.println(employee2.getFirstName()+" "
+employee,getLastName());
System.out.println(employee2.getHomeAddress());
}
public static void main (String [] args){
ClassPathXmlApplicationContext context=
new ClassPathXmlApplicationContext(new String []{"spring-config.xml"});
Product product1=context.getBean("product",Product.class);
product1. setName("Excellent snake oil");
System.out.println("product1:"+product1.getName());
Product product2=context.getBean("product",Product.class);
System.out.println("product2:"+product2.getName());
Product featuredProduct=context.getBean("featureProduct:"+Product.class);
System.out.println(featuredProduct.getName()+
","+featuredProduct.getDescription()+
","+featuredProduct.getPrice());
LocalDate localDate =context.getBean("localDate",
java.time.LocalDate.class);
System.out.println("today:"+localDate);
Employee employee1=context.getBean("employeel1",Employee.class);
System.out.println(employee1.getFirstName()+" "
+employee1.getLastName());
System.out.println(employee1.getHomeAddress());
Employee employee2=context.getBean("employee2",Employee.class);
System.out.println(employee2.getFirstName()+" "
+employee,getLastName());
System.out.println(employee2.getHomeAddress());
}
}