1. Inter-bean reference 

@Configuration 과 함께 @Bean 을 사용 하는 경우.

cglib proxy 에 의해 생성된 proxy 객체를 사용.

@Bean 은 하나만 생성된다.

일반적인 경우 위 방법을 사용한다.

 

2. Lite Mode

@Configuration 없이 @Component 등의 annotation과 @Bean을 같이 사용.

cglib proxy 에 의한 객체를 사용하지 않고 일반 메소드 처럼 동작하게 된다.

@Bean 이 여러개 생성 될 수 있다.

 

Lite Mode를 언제 사용하는지 모르겠다. 알아만 두자.

 

한글 설명 :

https://multifrontgarden.tistory.com/253

공식 doc :

https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/Bean.html

반응형

+ Recent posts