org.springframework.beans-3.0.5.RELEASE.jar
org.springframework.core-3.0.5.RELEASE.jar
applicationContext.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.xsd" > <bean id="samsung" class="exam.SamsungTV"/> </beans> |
TVUser,java
public class TVUser { public static void main(String[] args) { BeanFactory factory = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); TV tv = (SamsungTV)factory.getBean("samsung"); } } |
'프로그래밍 > spring' 카테고리의 다른 글
springMVC config (0) | 2015.10.28 |
---|---|
springMVC config (0) | 2015.10.28 |
sping ioc annotaion 기반 설정 예제 (0) | 2015.10.27 |
spring ApplicationContext bean 초기화 (0) | 2015.10.26 |
spring ajax (0) | 2015.07.29 |