Spring3.0 DI 3

2012. 5. 14. 19:10


==================================이론======================================

*의존관계 자동 설정

private Board board
          (Type) (Name)

byName : 프로퍼티의 이름과 같은 이름을 갖는 빈 객체를 설정한다.
byType : 프로퍼티의 타입과 같은 타입을 갖는 빈 객체를 설정한다.
constructor : 생성자 파라미터 타입과 같은 타입을 갖는 빈 객체를 생성자에 전달한다.
autodetect : constructor 방식을 먼저 적용하고, byType 방식을 적용하여 의존 객체를 설정한다.

<beans default-autowire="byName"> : 하위 태그 모두영향
   <bean autowire="byName"/> : 태그에 autowire 속성값지정
</beans>



*프로퍼티 타입을 이용한 의존관계 자동설정

1. 프로퍼티 이름을 이용한 의존 관계 자동 설정    

    <!-- 프로 퍼티  이름을 이용한 의존 관계 자동 설정-->
    <bean name="writeArticleService" class="madvirus.spring.chap02.WriteArticleServiceImpl" autowire="byName"/>
    <bean name="articleDao" class="madvirus.spring.chap02.MySQLArticleDao"/>  

    WriteArticleServiceImpl 클래스가 이름이 articleDao인 프로퍼티를 갖고 있다면, 이름이 articleDao 빈 객체가 프로퍼티의 값으로 전달된다.


2. 프로퍼티 타입을 이용한 의존관계 자동설정

    동일한 타입의 빈 객체가 두 개 이상 존재하게 되면 스프링은 어떤 빈 객체를 사용해야 할 지 알 수 없기 때문에 예외를 발생 시기키게 된다.
    이는 byType 방식을 이용할 경우, 프로퍼티 타입과 동일한 타입의 빈 객체를 오직 한개만 설정할 수 있다는 것을 의미며, 동일한 타입의 빈객체를 다수
    설정해야하는 경우 byType을 사용할수 없다.

    <!-- 프로퍼티 타입을 이용한 의존 관계 자동 설정  -->
    <bean name="writeArticleService2" class="madvirus.spring.chap02.WriteArticleServiceImpl" autowire="byType"/>
    <bean name="mysqlArticleDao" class="madvirus.spring.chap02.MySQLArticleDao"/>
    //<bean name="orcleArticleDao" class="madvirus.spring.chap02.MySQLArticleDao"/> 동일타입 빈객체가 존재하면 예외발생  


3. 생성자 파라미터 타입을 이용한 의존 관계 자동설정

    <!-- 생성자 파라미터 타입을 이용한 의존 관계 자동설정  -->
    <bean name="writeArticleService" class="madvirus.spring.chap02.WriteArticleServiceImpl" autowire="constructor"/>
    <bean name="mysqlArticleDao" class="madvirus.spring.chap02.MySQLArticleDao"/>

    이 경우  WriteArticleServiceImpl(ArticleDao articleDao) 생성자의 첫 번째 파라미터에 ArticleDao타입인 mysqlArticleDao 빈 객체가 전달된다.


4. 생성자 프로퍼티 타입을 이용한 자동설정

    <!-- 생성자 및 프로퍼티 타입을 이용한 자동설정  -->
    <bean name="writeArticleService" class="madvirus.spring.chap02.WriteArticleServiceImpl" autowire="autodetect"/>
    <bean name="mysqlArticleDao" class="madvirus.spring.chap02.MySQLArticleDao"/>

autodetect 방식은 constructor 방식을 먼저 적용하거, constructor 방식을 적용할 수 없는 경우 byType 방식을 적용하여 의존 객체를 설정해 준다.
autodetect 방식은 constructor 방식과 byType 방식을 사용하므로, 동일한 타입의 빈 객체를 2개 이상 정의할 수 없다는 단점을 그대로 갖는다.


5. 자동설정과 직접 설정의 혼합

경우에 따라서는 프로퍼티 중 일부는 자동 설정을 하지 않고 직접적으로 명시하고 싶을 때가 있을 것이다. 이런경우에는 자동 설정과 함께 <property>태그를 이용하여 해당 프로퍼티의 값을 직접 설정해 주면 된다.
    <bean name="writeArticleService" class="madvirus.spring.chap02.WriteArticleServiceImpl" autowire="byName">
        <property name="eventListener" ref="emailAdaptor" />
    </bean> 

특정 프로퍼티의 값이 자동 설정에 의해 초기화 되지 않도록 하려면, <null>태그를 이용하여 프로퍼티의 값을 null로 설정할 수도 있다.

    <bean name="writeArticleService" class="madvirus.spring.chap02.WriteArticleServiceImpl" autowire="byName">
        <property name="eventListener"><null/><</property>
    </bean> 

* 의존 관계를 자동으로 알맞게 설정해 주는 기능은 스프링 설정 파일의 크기를 줄여 주므로, 분명 유요한 기능임에 틀림없다.
  하지만 설정파일만으로 빈객체 간의 의존 관계를 파악하기 힘들다는 단점이있다. - 규모가 커지면 디버깅이 어렵게된다.
  가급적 빈객체 사이의 의존 관계를 모두 명시해준다.


* 부모 빈을 통한 설정 재사용 P88

빈 정보를 설정하다 보면 여러 빈태그의 설정 정보가 중복되는 경우가 있다.
중복되는 빈은 이름만 다를 뿐 나머지 설정은 대부분 동일한 것.
중복되는 설정을 갖는 빈이 다수 존재할 경우, 중복되는 설정 정보를 담고있는 부모 빈을 정의 한뒤 , 부모 빈 정보를 재사용 하도록 설정할 수 있다.

    <!-- 부모빈을 통한 설정 재사용 -->
    <bean id="commonMonitor" class="madvirus.spring.chap02.SystemMonitor" abstract="true">
        <property name="periodTime" value="10"></property>
        <property name="sender" ref="smsSender"></property>
    </bean>
    <bean id="doorMonitor" parent="commonMonitor" />
    <bean id="lobbyMonitor" parent="commonMonitor" />
    <bean id="roomMonitor" parent="commonMonitor">
        <property name="periodTime" value="20"></property>
    </bean>
    <bean id="smsSender" class="madvirus.spring.chap02.SmsSender"/>

<bean abstract="true">   abstract 속성값을 true로 지정하게 되면 스프링 컨테이너는 해당 빈 객체를 생성하지 않는다. 

자식 빈에서는 parent속성을 사용하여 클래스 및 프로퍼티 설정 정보를 물려 받을 부모 빈을 설정하면 된다.
위 코드의 경우 doorMonitor, lobbyMonitor, roomMonitor 빈이 모두 commonMonitor 빈의 설정 정보를 사용하도록 설정하고 있다.
따라서, 이 세 빈은 모두 class 속성의 값으로 madvirus.spring.chap02.SystemMonitor를 사용한다.

parent 속성을 이용하여 물려 받은 설정 정보 중에서 변경하고 싶은 값이 있다면 추가로 입력해주면 된다.
예를 들어, commonMonitor의 periodTime 프로퍼티의 값은 10인데, 다른 값을 사용하고 싶다면
위 코드에서 roomMonitor 빈 객체처럼 사용할 프로퍼티 값을 입력해주면 된다.
프로퍼티 뿐만 아니라 클래스도 새롭게 지정할 수 있다.


*빈객체범위 총 5개

singleton : 스프링 컨테이너에 한개의 빈 객체만 존재한다(기본값)
prototype : 빈을 사요할 때 마다 객체를 생성한다.

request : HTTP 요청 마다 빈 객체를 생성한다. WebApplicationContext에서만 적용 가능하다.
session : HTTP  세션 마다 빈 객체를 생성한다. WebApplicationContext에서만  적용 가능하다.
global-session : 글로벌 HTTP 세션에 대해빈 객체를 생성한다. 포틀릿을 지원하는 컨텍스트에 대해서만 적용 가능하다.

<bean id="workerBean" class="madvirus.spring.chap02.Worker" scope="singleton">
   .......................
</bean>


*서로 다른 범위 빈에 대한 의존 처리 P91

<bean id="workerBean" class="madvirus.spring.chap02.Worker" scope="prototype">
    <!-- <aop:scoped-proxy /> : id="workerBean"이 싱글턴을 사용할경우 싱글턴으로 인정하기때문에  프로토탑입으로 인정시키기위해 사용 -->
    <aop:scoped-proxy />
</bean>


*외부 설정 프로퍼티

방법1:

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
           <list>
            <value>classpath:config/jdbc.properties</value>
            <value>classpath:config/jdbc2.properties</value> // 한개이상의 프로퍼티 파일을 지정하려면 <list> 태그를 이용  교제P102
           </list>
        </property>
    </bean>

방법2:

    xmlns:context="http://www.springframework.org/schema/context"
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-3.0.xsd"
    beans에 등록후

    <context:property-placeholder location="classpath:config/jdbc.properties, classpath:config/jdbc2.properties"/>
                                                                                                       // 한개이상의 프로퍼티 파일을 지정하려면 , 로 구분

PropertyPlaceholderConfigurer 사용시 주의사항

PropertyPlaceholderConfigurer를 두번 설정하면안된다!!!! 위와같이 하나의 PropertyPlaceholderConfigurer에서 여러파일을 등록해서 사용
PropertyPlaceholderConfigurer를 나누면 예외발생



* 컨테이너 간 계층

BeanFactory 나 ApplicationContext는 컨테이너 간 자식- 부모의 계층 구조를 가질 수 있다.
컨테이너 간 계층 구조를 구성하면, 자식 컨테이너부모 컨테이너정의된 빈 객체에 접근할 수 있다.
반면에 부모 컨테이너에서자식 컨테이너정의된 빈객체에 접근할 수 없다.


 <!-- parent.xml -->
<bean id="smsSender" class="madvirus.spring.chap02.SmsSender"/>

<!-- child.xml -->
<bean id="monitor" class="madvirus.spring.chap02.SystemMonitor" p:periodTime="10" p:sender-ref="smsSender"/>
<bean id="smsSender" class="madvirus.spring.chap02.SmsSender"/>   



==================================프로젝트======================================
예제.
config
      jdbc.properties (외부 설정 프로퍼티)

madvirus.spring.chap02
     Article (객체형식을 지정할 용도)
     ArticleDao (인터페이스 insert메소드)
     Command (인터페이스 execute메소드)
     CommandFactory (인터페이스 createCommand 메소드)
     CommandFactoryImpl (CommandFactory를 구현 createCommand메소드 구현)
     DataSourceFactory (외부 설정 프로퍼티)
     Executor(서로 다른 범위 빈에 대한 의존 처리)
     Main05 (프로퍼티 이름을 이용한 의존 관계 자동 설정)
     Main06 (프로퍼티 타입을 이용한 의존관계 자동설정)
     Main07 (부모빈을 통한 설정 재사용)
     Main08 (서로 다른 범위 빈에 대한 의존 처리)
     Main09 (외부 설정 프로퍼티)
     MySQLArticleDao (ArticleDao 구현 insert메소드 구현)
     PerformanceMonitor (콜렉션 타입 프로퍼티 설정 - List타입과 배열)
     Processor (getCommandFactory메서드를 통해 CommandFactory를 객체생성 createCommand(commandName)
                      로 Command객체를 생성 execute메서드실행)
     SmsSender (객체형식을 지정할 용도)
     SomeCommand (Command 를 구현  execute메서드 구현)
     SystemMonitor (XML네임스페이스 출력부분)
     Worker (서로 다른 범위 빈에 대한 의존 처리)
     WorkUnit (서로 다른 범위 빈에 대한 의존 처리)
     WriteArticleService (인터페이스 write메소드)
     WriteArticleServiceImpl (WriteArticleService를 구현한 write메소드 구현)
applicationContext03.xml (외부 설정 프로퍼티)
applicationContext2.xml (DI(Dependency Injection 처리): 객체의 외부에서 두개의 의존성있는 객체의 관계를 형성)


==================================코드======================================

예제.
config
      jdbc.properties (외부 설정 프로퍼티)
jdbc.driver=oracle.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@localhost:1521:orcl
jdbc.username=hr
jdbc.password=hr

madvirus.spring.chap02
     Article (객체형식을 지정할 용도)
package madvirus.spring.chap02;

public class Article {

}

     ArticleDao (인터페이스 insert메소드)
package madvirus.spring.chap02;

public interface ArticleDao {
    void insert(Article article);
}

     Command (인터페이스 execute메소드)
package madvirus.spring.chap02;

public interface Command {   
    void execute();
}

     CommandFactory (인터페이스 createCommand 메소드)
package madvirus.spring.chap02;

public interface CommandFactory {

    Command createCommand(String commandName);
}

     CommandFactoryImpl (CommandFactory를 구현 createCommand메소드 구현)
package madvirus.spring.chap02;

public class CommandFactoryImpl implements CommandFactory{

    @Override
    public Command createCommand(String commandName) {
        if(commandName.equals("some")){
            return new SomeCommand();
        }
        return null;
    }
}

     DataSourceFactory (외부 설정 프로퍼티)
package madvirus.spring.chap02;

public class DataSourceFactory {

    private String jdbcDriver;
    private String jdbcUrl;
    private String username;
    private String password;
   
    public void setJdbcDriver(String jdbcDriver) {
        this.jdbcDriver = jdbcDriver;
    }
    public void setJdbcUrl(String jdbcUrl) {
        this.jdbcUrl = jdbcUrl;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public void setPassword(String password) {
        this.password = password;
    }
   
    @Override
    public String toString() {
        return "DataSourceFactory [jdbcDriver=" + jdbcDriver + ", jdbcUrl="
                + jdbcUrl + ", username=" + username + ", password=" + password
                + "]";
    }   
}


     Executor(서로 다른 범위 빈에 대한 의존 처리)
package madvirus.spring.chap02;

public class Executor {

    private Worker worker;
   
    public void addUnit(WorkUnit work){
        worker.work(work);
    }
   
    public void setWorker(Worker worker){
        this.worker = worker;
    }
}

     Main05 (프로퍼티 이름을 이용한 의존 관계 자동 설정)
package madvirus.spring.chap02;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main05 {
    public static void main(String[] args){
        String[] configLocations = new String[] {"applicationContext2.xml" };
        ApplicationContext context = new ClassPathXmlApplicationContext(configLocations);
       
        //프로퍼티 이름을 이용한 의존 관계 자동 설정
        WriteArticleService articleService = (WriteArticleService)context.getBean("writeArticleService");
       
        articleService.write(new Article());
    }
}

     Main06 (프로퍼티 타입을 이용한 의존관계 자동설정)
package madvirus.spring.chap02;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main06 {
    public static void main(String[] args){
        String[] configLocations = new String[] {"applicationContext2.xml"};
        ApplicationContext context =new ClassPathXmlApplicationContext(configLocations);
       
        //프로퍼티 타입을 이용한 의존관계 자동설정
        WriteArticleService articleService= (WriteArticleService)context.getBean("writeArticleService2");
       
        articleService.write(new Article());
    }
}   

     Main07 (부모빈을 통한 설정 재사용)
package madvirus.spring.chap02;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main07 {
    public static void main(String[] args){
        String[] configLocations = new String[] {"applicationContext2.xml" };
        ApplicationContext context = new ClassPathXmlApplicationContext(configLocations);
       
        //부모 빈을 통한 설정 재사용
        SystemMonitor articleService = (SystemMonitor)context.getBean("doorMonitor");
        System.out.println(articleService);
        SystemMonitor articleService02 = (SystemMonitor)context.getBean("lobbyMonitor");
        System.out.println(articleService02);
        SystemMonitor articleService03 = (SystemMonitor)context.getBean("roomMonitor");
        System.out.println(articleService03);
       
    }
}

     Main08 (서로 다른 범위 빈에 대한 의존 처리)
package madvirus.spring.chap02;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main08 {
    public static void main(String[] args){
        String[] configLocations = new String[] {"applicationContext2.xml" };
        ApplicationContext context = new ClassPathXmlApplicationContext(configLocations);
       
        //서로 다른 범위 빈에 대한 의존 처리
        Executor executor = context.getBean("executor",Executor.class);
        executor.addUnit(new WorkUnit());
        executor.addUnit(new WorkUnit());
        executor.addUnit(new WorkUnit());
       
        Worker worker = context.getBean("workerBean", Worker.class);
        worker.work(new WorkUnit());
        worker.work(new WorkUnit());
    }   
}

     Main9 (외부 설정 프로퍼티)
package madvirus.spring.chap02;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main09 {
    public static void main(String[] args){
        String[] configLocations = new String[] {"applicationContext03.xml" };
        ApplicationContext context = new ClassPathXmlApplicationContext(configLocations);
       
        DataSourceFactory dataSourceFactory = context.getBean("dataSourceFactory",DataSourceFactory.class);
       
        System.out.println(dataSourceFactory.toString());
    }
}


     MySQLArticleDao (ArticleDao 를 구현 insert메소드 구현)
package madvirus.spring.chap02;

public class MySQLArticleDao implements ArticleDao{
   
    @Override
    public void insert(Article article){
        System.out.println("MySQLArticleDao.insert()실행");
    }
}


     PerformanceMonitor (콜렉션 타입 프로퍼티 설정 - List타입과 배열)
package madvirus.spring.chap02;

import java.util.List;

public class PerformanceMonitor {
   
    private List<Double> deviations;
   
    public void setDeviations(List<Double> deviations){
        this.deviations = deviations;
    }

    @Override
    public String toString() {
        return "PerformanceMonitor [deviations=" + deviations + "]";
    }
}

     Processor (getCommandFactory메서드를 통해 CommandFactory를 객체생성 createCommand(commandName)
                      로 Command객체를 생성 execute메서드실행)
package madvirus.spring.chap02;

public class Processor {

    public void process(String commandName){
        CommandFactory factory = getCommandFactory();
        Command command = factory.createCommand(commandName);
        command.execute();
    }
   
    protected CommandFactory getCommandFactory(){
        return null;
    }
}

     SmsSender (객체형식을 지정할 용도)
package madvirus.spring.chap02;

public class SmsSender {
}

     SomeCommand (Command 를 구현  execute메서드 구현)
package madvirus.spring.chap02;

public class SomeCommand implements Command{

    @Override
    public void execute() {
        System.out.println("SomeCommand executed.");
    }   
}

     SystemMonitor (XML네임스페이스 출력부분)
package madvirus.spring.chap02;

public class SystemMonitor {
   
    private long periodTime;
    private SmsSender sender;
   
   
    public void setPeriodTime(long periodTime) {
        this.periodTime = periodTime;
    }
    public void setSender(SmsSender sender) {
        this.sender = sender;
    }
   
    @Override
    public String toString() {
        return "SystemMonitor [periodTime=" + periodTime + ", sender=" + sender
                + "]";
    }
}

     Worker (서로 다른 범위 빈에 대한 의존 처리)
package madvirus.spring.chap02;

public class Worker {
   
    public void work(WorkUnit unit){
        System.out.println(toString()+" work " + unit);
    }
}

     WorkUnit (서로 다른 범위 빈에 대한 의존 처리)
package madvirus.spring.chap02;

public class WorkUnit {

}

     WriteArticleService (인터페이스 write메소드)
package madvirus.spring.chap02;

public interface WriteArticleService {
    void write(Article article);
}

     WriteArticleServiceImpl (WriteArticleService를 구현한 write메소드 구현)
package madvirus.spring.chap02;

public class WriteArticleServiceImpl implements WriteArticleService{

    private ArticleDao articleDao;
   
    //의존 관계 설정 방식: 프로퍼티
    public void setArticleDao(ArticleDao articleDao){
        this.articleDao = articleDao;
    }   
   
    @Override
    public void write(Article article) {       
        System.out.println("WriteArticleServiceImpl.write() 메서드 실행");
        articleDao.insert(article);
    }   
}

applicationContext03.xml (외부 설정 프로퍼티)
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    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-3.0.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<!--    
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>classpath:config/jdbc.properties</value>
        </property>
    </bean>
-->
   
    <context:property-placeholder location="classpath:config/jdbc.properties"/>
   
    <bean id="dataSourceFactory" class="madvirus.spring.chap02.DataSourceFactory">
        <property name="jdbcDriver" value="${jdbc.driver}"/>
        <property name="jdbcUrl" value="${jdbc.url}"/>       
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>       
    </bean>   
</beans>

applicationContext2.xml (DI(Dependency Injection 처리): 객체의 외부에서 두개의 의존성있는 객체의 관계를 형성)
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:context="http://www.springframework.org/schema/context"
    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-3.0.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <!-- 프로 퍼티  이름을 이용한 의존 관계 자동 설정-->
    <bean name="writeArticleService" class="madvirus.spring.chap02.WriteArticleServiceImpl" autowire="byName"/>

    <bean name="articleDao" class="madvirus.spring.chap02.MySQLArticleDao"/>
   
    <!-- 프로퍼티 타입을 이용한 의존 관계 자동 설정  -->
    <bean name="writeArticleService2" class="madvirus.spring.chap02.WriteArticleServiceImpl" autowire="byType"/>
   
    <bean name="mysqlArticleDao" class="madvirus.spring.chap02.MySQLArticleDao"/>
   
    <!-- 부모빈을 통한 설정 재사용 -->
    <bean id="commonMonitor" class="madvirus.spring.chap02.SystemMonitor" abstract="true">
        <property name="periodTime" value="10"></property>
        <property name="sender" ref="smsSender"></property>
    </bean>
    <bean id="doorMonitor" parent="commonMonitor" />
    <bean id="lobbyMonitor" parent="commonMonitor" />
    <bean id="roomMonitor" parent="commonMonitor">
        <property name="periodTime" value="20"></property>
    </bean>
    <bean id="smsSender" class="madvirus.spring.chap02.SmsSender"/>
   
    <!-- 서로 다른 범위 빈에 대한 의존 처리  -->
    <bean id="workerBean" class="madvirus.spring.chap02.Worker" scope="prototype">
    <!-- <aop:scoped-proxy /> :id="workerBean"이 싱글턴을 사용할경우 싱글턴으로 인정하기때문에  프로토탑입으로 인정시키기위해 사용 -->
        <aop:scoped-proxy />
    </bean>
   
    <bean id="executor" class="madvirus.spring.chap02.Executor">
        <property name="worker" ref="workerBean"/>
    </bean>       
   
</beans>

==================================결과값=====================================

1.프로퍼티 이름을 이용한 의존 관계 자동 설정

   



2.프로퍼티 타입을 이용한 의존관계 자동설정

   



3. 부모빈을 통한 설정 재사용

   



4. 서로 다른 범위 빈에 대한 의존 처리


    <aop:scoped-proxy /> 처리

    

     <aop:scoped-proxy /> 빼면 같아짐 Worker가 싱글턴이기 때문

   

5. 외부 설정 프로퍼티

    


'스프링3.0' 카테고리의 다른 글

Spring3.0 MVC 웹요청 처리  (0) 2012.05.14
Spring 3.0 AOP  (0) 2012.05.14
스프링 3.0 @ 어노테이션 기반 설정  (0) 2012.05.14
Spring3.0 message&event  (1) 2012.05.14
Spring3.0 Di 2  (0) 2012.05.14
Posted by 사라링
BLOG main image
.. by 사라링

카테고리

사라링님의 노트 (301)
JSP (31)
J-Query (41)
JAVA (24)
VM-WARE (0)
디자인패턴 (1)
스크랩 (0)
스트러츠 (3)
안드로이드 (11)
오라클 (45)
우분투-오라클 (1)
이클립스메뉴얼 (6)
스프링3.0 (23)
자바스크립트 (10)
HTML5.0 (17)
정보처리기사 (1)
기타(컴퓨터 관련) (1)
문제점 해결 (3)
프로젝트 (2)
AJAX (4)
하이버네이트 (3)
트러스트폼 (11)
Jeus (2)
재무관리(회계) (5)
정규식 (5)
아이바티스 (8)
취미 (2)
소프트웨어 보안 관련모음 (0)
정보보안기사 (6)
C언어 베이직 및 프로그램 (3)
보안 관련 용어 정리 (2)
넥사크로 (6)
Total :
Today : Yesterday :