public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("house-config.xml"); House house = (House) context.getBean("house"); System.out.println(house.getPrice()); }