- Today
- Total
- μλ£κ΅¬μ‘°
- array
- MST
- java
- OOP
- dp
- tree
- 그리λ
- νλ‘κ·Έλλ¨Έμ€
- CS
- pytorch
- spring
- μμμ λ ¬
- μ‘Έμ μν
- λ°±μλ
- Algorithm
- μλ°
- PS
- database
- λ¬Έλ²
- λ°μ΄ν°λ² μ΄μ€
- ꡬν
- BFS
- λ€μ΅μ€νΈλΌ
- Graph
- λ°±μ€
- leetcode
- μΈν΄
- μλ°μμ μ
- 벨λ§ν¬λ
Partially Committed
[Spring] μ€νλ§ μ»¨ν μ΄λμ μ€νλ§ λΉ λ³Έλ¬Έ
μ€νλ§ μ»¨ν μ΄λμ μ€νλ§ λΉ
2022. 1. 10.
# μ€νλ§ μ»¨ν μ΄λ μμ±
- ApplicationContext λ₯Ό μ€νλ§ μ»¨ν μ΄λλΌκ³ νλ€.
- ApplicationContext λ Interface μ΄λ€.
- μ€νλ§ μ»¨ν μ΄λλ XML μ κΈ°λ°μΌλ‘ λ§λ€ μ μκ³ μ λ Έν μ΄μ κΈ°λ°μ μλ° μ€μ ν΄λμ€λ‘ λ§λ€ μ μλ€.
new AnnotationConfigApplicationContext(AppConfig.class);
- μ ν΄λμ€λ ApplicationContext μΈν°νμ΄μ€μ ꡬν체μ΄λ€.
- μ€νλ§ μ»¨ν μ΄λλ₯Ό λΆλ₯Ό λ BeanFactory, ApplicationContext λ‘ κ΅¬λΆν΄μ λΆλ₯΄μ§λ§ BeanFactory λ₯Ό μ§μ μ¬μ©νλ κ²½μ°κ° μκ³ μΌλ°μ μΌλ‘ ApplicationContext λ₯Ό μ€νλ§ μ»¨ν μ΄λλΌκ³ νλ€λ κ²μ μμλμ.
- μ€νλ§ μ»¨ν μ΄λμ μμ± κ³Όμ μ μλμ κ°λ€.
(1) μ€νλ§ μ»¨ν μ΄λ μμ±
: new AnnotationConfigApplicationContext(AppConfig.class); μ κ°μ΄ AppConfig.class λ₯Ό κ΅¬μ± μ λ³΄λ‘ μ€νλ§ μ»¨ν μ΄λλ₯Ό μμ±νλ©΄ μ€νλ§ μ»¨ν μ΄λλ κ΅¬μ± μ 보λ₯Ό νμ©νμ¬,
(2) μ€νλ§ λΉ λ±λ‘
: μ€νλ§ μ»¨ν μ΄λ λ΄λΆμ μ€νλ§ λΉ μ μ₯μλ₯Ό μ±μ΄λ€. νλΌλ―Έν°λ‘ λμ΄μ¨ μ€μ ν΄λμ€μ μ 보λ₯Ό μ¬μ©νμ¬ μ€νλ§ λΉμ λ±λ‘νλ€. λΉ μ΄λ¦μ λ©μλ μ΄λ¦μ μ¬μ©νλ©°, @Bean(name="memberService2") μ κ°μ΄ μ§μ λΆμ¬ν μ λ μλ€. νμ§λ§ λΉ μ΄λ¦μ΄ μ€λ³΅λμ΄μλ μλλ€.
(3) μ€νλ§ λΉ μμ‘΄κ΄κ³ μ€μ
: μ€νλ§ μ»¨ν μ΄λλ μ€μ μ 보λ₯Ό μ°Έκ³ νμ¬ μμ‘΄κ΄κ³λ₯Ό μ£Όμ (DI) νλ€. μ€νλ§μ λΉμ μμ±νκ³ μ£Όμ νλ λ¨κ³κ° ꡬλΆλλ€. μλ° μ½λλ₯Ό μ΄μ©νμ¬ μ€νλ§ λΉμ λ±λ‘νλ©΄ μμ±μλ₯Ό νΈμΆνλ©΄μ μμ‘΄κ΄κ³ μ£Όμ λν νλ²μ μ²λ¦¬λλ€.
# 컨ν μ΄λμ λ±λ‘λ λͺ¨λ λΉ μ‘°ννκΈ°
μλ μ½λλ₯Ό μ€ννλ©΄ μ€νλ§μ λ±λ‘λ λͺ¨λ λΉ μ 보λ₯Ό μ‘°νν μ μλ€.
@Test
@DisplayName("λͺ¨λ λΉ μΆλ ₯νκΈ°")
void findAllBean(){
String[] beanDefinitionNames = ac.getBeanDefinitionNames();
System.out.println("λͺ¨λ λΉ μΆλ ₯νκΈ°");
for (String beanDefinitionName : beanDefinitionNames) {
Object bean = ac.getBean(beanDefinitionName);
System.out.println("name = " + beanDefinitionName + "object = " + bean);
}
}
λ§μ½ μ€νλ§ λΉμ Role μ λ°λΌ μΆλ ₯νκ³ μ νλ€λ©΄ getRole() λ©μλλ₯Ό μ΄μ©νλ€. ROLE_APPLICATION μ μΌλ°μ μΌλ‘ μ¬μ©μκ° μ μν λΉμ΄κ³ ROLE_INFRASTRUCTURE μ μ€νλ§μ΄ λ΄λΆμμ μ¬μ©νλ λΉμ΄λ€.
@Test
@DisplayName("μ ν리μΌμ΄μ
λΉ μΆλ ₯νκΈ°")
void findApplicationBean(){
String[] beanDefinitionNames = ac.getBeanDefinitionNames();
System.out.println("μ ν리μΌμ΄μ
λΉ μΆλ ₯νκΈ°");
for (String beanDefinitionName : beanDefinitionNames) {
BeanDefinition beanDefinition = ac.getBeanDefinition(beanDefinitionName);
if(beanDefinition.getRole()==BeanDefinition.ROLE_APPLICATION){
// ROLE_APPLICATION : μ§μ λ±λ‘ν μ ν리μΌμ΄μ
λΉ
// ROLE_INFRASTRUCTURE : μ€νλ§μ΄ λ΄λΆμμ μ¬μ©νλ λΉ
Object bean = ac.getBean(beanDefinitionName);
System.out.println("name = " + beanDefinitionName + "object = " + bean);
}
}
μ€νλ§ μ»¨ν μ΄λμμ μ€νλ§ λΉμ μ‘°νν λ μλμ κ°μ΄ ν΄μ£Όλ©΄ λλ€.
- ac.getBean(BeanName, Type)
- ac.getBean(Type)
λ§μ½ μ‘°ν λμμΈ μ€νλ§ λΉμ΄ μ‘΄μ¬νμ§ μμΌλ©΄ μλμ μμΈκ° λ°μλλ€.
- NoSuchBeanDefinitionException: No bean named 'xx' available
public class ApplicationContextBeanFindTest {
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(AppConfig.class);
@Test
@DisplayName("λΉ μ΄λ¦μΌλ‘ μ‘°ν")
void findBeanByName(){
MemberService memberService = ac.getBean("memberService", MemberService.class);
assertThat(memberService).isInstanceOf(MemberServiceImpl.class);
}
@Test
@DisplayName("μ΄λ¦ μμ΄ νμ
μΌλ‘λ§ μ‘°ν")
void findBeanByType(){
MemberService memberService = ac.getBean( MemberService.class);
assertThat(memberService).isInstanceOf(MemberServiceImpl.class);
}
@Test
@DisplayName("ꡬ체 νμ
μΌλ‘ μ‘°ν")
// ꡬ체 νμ
μΌλ‘ μ‘°ννλ κ²μ λ³λ‘ μ’μ§ μλ€. μ μ°μ±μ΄ μ νλκΈ° λλ¬Έμ΄λ€.
void findBeanByName2(){
MemberService memberService = ac.getBean("memberService", MemberServiceImpl.class);
assertThat(memberService).isInstanceOf(MemberServiceImpl.class);
}
@Test
@DisplayName("λΉ μ΄λ¦μΌλ‘ μ‘°νX")
void findBeanByNameX(){
assertThrows(NoSuchBeanDefinitionException.class,
() -> ac.getBean("xxxx", MemberService.class));
}
}
μ€νλ§ λΉμ μ‘°νν λ, λμΌν νμ μ΄ λ κ° μ΄μμΈ κ²½μ°μλ μ΄λ»κ² ν΄μΌν κΉ?
- λΉ μ΄λ¦μ μ§μ ν΄μ£Όλ©΄ λλ€.
- νμ μ ac.getBeansOfType() λ₯Ό μ¬μ©νλ©΄ ν΄λΉνλ type μ λͺ¨λ λΉμ μ‘°νν μ μλ€.
package hello.core.beanfind;
import hello.core.member.MemberRepository;
import hello.core.member.MemoryMemberRepository;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Map;
import static org.assertj.core.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class ApplicationContextSameBeanFindTest {
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(SameBeanConfig.class);
@Test
@DisplayName("νμ
μΌλ‘ μ‘°ν μ κ°μ νμ
μ΄ λκ° μ΄μ μμΌλ©΄, μ€λ³΅ μ€λ₯κ° λ°μ")
void findBeanByTypeDuplicate(){
assertThrows(NoUniqueBeanDefinitionException.class,
() -> ac.getBean(MemberRepository.class));
}
@Test
@DisplayName("νμ
μΌλ‘ μ‘°ν μ κ°μ νμ
μ΄ λκ° μ΄μ μμΌλ©΄, λΉ μ΄λ¦μ μ§μ ν κ²")
void findBeanByName(){
MemberRepository memberRepository = ac.getBean("memberRepository1", MemberRepository.class);
assertThat(memberRepository).isInstanceOf(MemberRepository.class);
}
@Test
@DisplayName("νΉμ νμ
μ λͺ¨λ μ‘°ν")
void findAllBeanByType(){
Map<String, MemberRepository> beansOfType = ac.getBeansOfType(MemberRepository.class);
for (String key : beansOfType.keySet()) {
System.out.println("key = " + key + " value = " + beansOfType.get(key));
}
System.out.println("beansOfType = " + beansOfType);
assertThat(beansOfType.size()).isEqualTo(2);
}
@Configuration
static class SameBeanConfig {
// staic : ApplicationContextSameBeanFindTest class μμμλ§ μ¬μ©νλλ‘ scope μ€μ
@Bean
public MemberRepository memberRepository1() {
return new MemoryMemberRepository();
}
@Bean
public MemberRepository memberRepository2() {
return new MemoryMemberRepository();
}
}
}
μ€νλ§ λΉ μ‘°ν - μμ κ΄κ³
- λΆλͺ¨ νμ μΌλ‘ μ‘°ν μ μμ νμ μ΄ ν¨κ» μ‘°νλλ€.
- κ·Έλμ Object μΌλ‘ μ‘°ννλ©΄ λͺ¨λ μ€νλ§ λΉμ λ€ μ‘°ννκ² λλ κ².
package hello.core.beanfind;
import hello.core.discount.DiscountPolicy;
import hello.core.discount.FixDiscountPolicy;
import hello.core.discount.RateDiscountPolicy;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Map;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class ApplicationContextExtendsFindTest {
ApplicationContext ac = new AnnotationConfigApplicationContext(TestConfig.class);
@Test
@DisplayName("λΆλͺ¨ νμ
μΌλ‘ μ‘°ν μ, μμμ΄ λ μ΄μ μμΌλ©΄ μ€λ³΅ μ€λ₯κ° λ°μ")
void findBeanByParentTypeDuplicate(){
assertThrows(NoUniqueBeanDefinitionException.class,
()->ac.getBean(DiscountPolicy.class));
}
@Test
@DisplayName("λΆλͺ¨ νμ
μΌλ‘ μ‘°ν μ, μμμ΄ λ μ΄μ μμΌλ©΄ λΉ μ΄λ¦μ μ§μ ν κ²")
void findBeanByParentTypeBeanName(){
DiscountPolicy rateDiscountPolicy = ac.getBean("rateDiscountPolicy", DiscountPolicy.class);
assertThat(rateDiscountPolicy).isInstanceOf(RateDiscountPolicy.class);
}
@Test
@DisplayName("νΉμ νμ νμ
μΌλ‘ μ‘°ν")
void findBeanBySubType(){
RateDiscountPolicy bean = ac.getBean(RateDiscountPolicy.class);
assertThat(bean).isInstanceOf(RateDiscountPolicy.class);
}
@Test
@DisplayName("λΆλͺ¨ νμ
μΌλ‘ λͺ¨λ μ‘°ν")
void findAllBeanByParentType(){
Map<String, DiscountPolicy> beansOfType = ac.getBeansOfType(DiscountPolicy.class);
assertThat(beansOfType.size()).isEqualTo(2);
for (String key : beansOfType.keySet()) {
System.out.println("key = " + key + " value = " + beansOfType.get(key));
}
}
@Test
@DisplayName("λΆλͺ¨ νμ
μΌλ‘ λͺ¨λ μ‘°ννκΈ° - Object")
void findAllBeanByObjectType(){
Map<String, Object> beansOfType = ac.getBeansOfType(Object.class);
for (String key : beansOfType.keySet()) {
System.out.println("key = " + key + " value = " + beansOfType.get(key));
}
}
@Configuration
static class TestConfig{
@Bean
public DiscountPolicy rateDiscountPolicy(){
return new RateDiscountPolicy();
}
@Bean
public DiscountPolicy fixDiscountPolicy(){
return new FixDiscountPolicy();
}
}
}
# BeanFactory μ ApplicationContext
* BeanFactory
- μ€νλ§ μ»¨ν μ΄λμ μ΅μμ μΈν°νμ΄μ€
- μ€νλ§ λΉμ κ΄λ¦¬/μ‘°ν
- getBean() μ μ 곡
* ApplicationContext
- BeanFactory μ κΈ°λ₯μ λͺ¨λ μμλ°μμ μ 곡
- μ ν리μΌμ΄μ μ κ°λ°ν λμλ λΉμ κ΄λ¦¬/μ‘°ννλ κΈ°λ₯ μΈμ μ λ§μ λΆκ° κΈ°λ₯μ΄ νμνλ€. ApplicationContext λ BeanFactory λΏλ§μ΄ μλλΌ MessageSource(κ΅μ ν κΈ°λ₯; νκ΅μμ μ μ μ νκ΅μ΄λ‘, μμ΄κΆμμ μ μ μ μμ΄λ‘ μΆλ ₯), EnvironmentCapable(νκ²½ λ³μ; λ‘컬 κ°λ°, μ΄μ λ±μ ꡬλΆνμ¬ μ²λ¦¬), ApplicationEventPublisher(μ΄λ²€νΈλ₯Ό λ°ννκ³ κ΅¬λ νλ λͺ¨λΈμ μ§μ), ResourceLoader(νμΌ, ν΄λμ€ν¨μ€, μΈλΆ λ±μμ 리μμ€λ₯Ό νΈλ¦¬νκ² μ‘°ν κ°λ₯) μ κΈ°λ₯μ μμλ°λλ€.
μ¦, ApplicationContext λ BeanFactory μ κΈ°λ₯μ μμλ°μΌλ©° λΉ κ΄λ¦¬κΈ°λ₯ + νΈλ¦¬ν λΆκ°κΈ°λ₯μ μ 곡νλ€. BeanFactory λ₯Ό μ§μ μ¬μ©ν κ²½μ°λ κ±°μ μμΌλ©°, μΌλ°μ μΌλ‘ μ¬λ¬ λΆκ° κΈ°λ₯μ΄ ν¬ν¨λ ApplicationContext λ₯Ό μ¬μ©νλ€. BeanFactory λ ApplicationContext λ₯Ό μ€νλ§ μ»¨ν μ΄λλΌκ³ νλ€.
# μλ° μ½λμ XML
μ€νλ§ μ»¨ν μ΄λλ λ€μν μ€μ νμμ μ§μνλ€. (JAVA, XML, Groovy)
* Annotation κΈ°λ° JAVA μ½λ μ€μ μ¬μ©
- new AnnotationConfigApplicationContext(AppConfig.class)
- AnnotationConfigApplicationContext ν΄λμ€λ₯Ό μ¬μ©νμ¬ μλ° μ½λλ‘ λ μ€μ μ 보λ₯Ό λκΈ°λ©΄ λλ€.
* XML μ€μ μ¬μ©
- μ΅κ·Όμλ μ€νλ§ λΆνΈλ₯Ό λ§μ΄ μ¬μ©νλ©΄μ XML κΈ°λ°μ μ€μ μ μ μ¬μ©νμ§ μμ. μμ§ λ§μ λ κ±°μ νλ‘μ νΈλ€μ΄ XML μ΄ λμ΄μκΈ°λ νκ³ , XML μ μ¬μ©νλ©΄ μ»΄νμΌ κ³Όμ μμ΄ bean μ€μ μ 보λ₯Ό λ³κ²½ν μ μλ€λ μ₯μ μ΄ μκΈ°μ κ°λ³κ² μμλλ κ²μ κΆμ₯νλ€κ³ νλ€.
- GenericXmlApplicationContext λ₯Ό μ¬μ©νλ©΄μ 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="memberService" class="hello.core.member.MemberServiceImpl">
<constructor-arg name="memberRepository" ref="memberRepository" />
</bean>
<bean id="memberRepository" class="hello.core.member.MemoryMemberRepository" />
<bean id="orderService" class="hello.core.order.OrderServiceImpl">
<constructor-arg name="memberRepository" ref="memberRepository" />
<constructor-arg name="discountPolicy" ref="discountPolicy" />
</bean>
<bean id="discountPolicy" class="hello.core.discount.RateDiscountPolicy" />
</beans>
public class XmlAppContext {
@Test
void xmlAppContext(){
ApplicationContext ac = new GenericXmlApplicationContext("appConfig.xml");
Object memberService = ac.getBean("memberService", MemberService.class);
Assertions.assertThat(memberService).isInstanceOf(MemberService.class);
}
}
# μ€νλ§ λΉ μ€μ λ©ν μ 보 - BeanDefinition
- μ€νλ§μ΄ λ€μν μ€μ νμμ μ§μν μ μλ μ΄μ λ BeanDefinition μ΄λΌλ μΆμν κ°λ μ΄ μκΈ° λλ¬Έμ΄λ€.
- Spring bean μ λ§λ€ λμλ λ κ°μ§ λ°©λ²μ΄ μλ€. μ§μ μ μΌλ‘ Spring bean μ λ±λ‘νκ±°λ, factoryBean μ μ΄μ©νμ¬ λ±λ‘νκ±°λ! μΌλ°μ μΌλ‘ μλ° μ½λλ₯Ό μ΄μ©ν΄μ νλ κ²μ factoryBean μ μ΄μ©νμ¬ λ±λ‘νλ κ²μ΄λ€.
- μν κ³Ό ꡬνμ κ°λ μ μΌλ‘ λ΄λ κ²!
- XML μ΄λ©΄ XML μ½μ΄μ BeanDefinition μ λ§λ€λ©΄ λ¨.
- JAVA μ½λ μ΄λ©΄ JAVA μ½λ μ½μ΄μ BeanDefinition μ λ§λ€λ©΄ λ¨.
- μ€νλ§ μ»¨ν μ΄λλ μλ° μ½λμΈμ§ XML μΈμ§ λͺ°λΌλ λλ€. μ€μ§ BeanDefinition λ§ μλ©΄ λ¨!
- μ΄λ¬ν BeanDefinition μ λΉ μ€μ λ©ν μ 보λΌκ³ νλ€.
- '@Bean' , '<bean>' λΉ κ°κ° νλμ λ©ν μ λ³΄κ° μμ±λ¨.
- μ€νλ§ μ»¨ν μ΄λλ μ΄λ¬ν λ©ν μ 보λ₯Ό κΈ°λ°μΌλ‘ μ€νλ§ λΉμ μμ±ν¨.
- AnnotationConfigApplicationContext λ AnnotatedBeanDefinitionReader λ₯Ό μ¬μ©νμ¬ AppConfig.class λ₯Ό μ½κ³ BeanDefinition μ μμ±
- GenericXmlApplicationContext λ XmlBeanDefinitionReader λ₯Ό μ¬μ©ν΄μ appConfig.xml μ€μ μ 보λ₯Ό μ½κ³ BeanDefinition μ μμ±
- μλ‘μ΄ νμμ μ€μ μ λ³΄κ° μΆκ°λλ©΄, XxxBeanDefinitionReader λ₯Ό λ§λ€μ΄μ BeanDefinition μ μμ±νλ©΄ λλ μ!
public class BeanDefinitionTest {
AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(AppConfig.class);
// GenericXmlApplicationContext ac = new GenericXmlApplicationContext("appConfig.xml");
@Test
@DisplayName("λΉ μ€μ λ©νμ 보 νμΈ")
void findApplicationBean(){
String[] beanDefinitionNames = ac.getBeanDefinitionNames();
for (String beanDefinitionName : beanDefinitionNames) {
BeanDefinition beanDefinition = ac.getBeanDefinition(beanDefinitionName);
if(beanDefinition.getRole() == BeanDefinition.ROLE_APPLICATION){
System.out.println("beanDefinition name = " + beanDefinitionName + " beanDefinition = " + beanDefinition);
}
}
}
}
// AnnotationConfigApplicationContext
beanDefinition name = appConfig beanDefinition = Generic bean: class [hello.core.AppConfig$$EnhancerBySpringCGLIB$$e7bee251]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null
beanDefinition name = memberService beanDefinition = Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=appConfig; factoryMethodName=memberService; initMethodName=null; destroyMethodName=(inferred); defined in hello.core.AppConfig
beanDefinition name = memberRepository beanDefinition = Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=appConfig; factoryMethodName=memberRepository; initMethodName=null; destroyMethodName=(inferred); defined in hello.core.AppConfig
beanDefinition name = orderService beanDefinition = Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=appConfig; factoryMethodName=orderService; initMethodName=null; destroyMethodName=(inferred); defined in hello.core.AppConfig
beanDefinition name = discountPolicy beanDefinition = Root bean: class [null]; scope=; abstract=false; lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=appConfig; factoryMethodName=discountPolicy; initMethodName=null; destroyMethodName=(inferred); defined in hello.core.AppConfig
Process finished with exit code 0
// XML
beanDefinition name = memberService beanDefinition = Generic bean: class [hello.core.member.MemberServiceImpl]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [appConfig.xml]
beanDefinition name = memberRepository beanDefinition = Generic bean: class [hello.core.member.MemoryMemberRepository]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [appConfig.xml]
beanDefinition name = orderService beanDefinition = Generic bean: class [hello.core.order.OrderServiceImpl]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [appConfig.xml]
beanDefinition name = discountPolicy beanDefinition = Generic bean: class [hello.core.discount.RateDiscountPolicy]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [appConfig.xml]
Process finished with exit code 0
- BeanClassName : μμ±ν λΉμ ν΄λμ€ λͺ (java μ€μ μ²λΌ ν©ν 리 μν μ λΉμ μ¬μ©νλ κ²½μ°μλ μμ)
- factoryBeanName : ν©ν 리 μν μ λΉμ μ¬μ©ν κ²½μ° μ΄λ¦ (μ: appConfig)
- factoryMethodName : λΉμ μμ±ν ν©ν 리 λ©μλ μ§μ (μ: memberService)
- Scope : μ±κΈν€(default)
- lazyInit : μ€νλ§ μ»¨ν μ΄λλ₯Ό μμ±ν λ, λΉμ μμ±νλ κ²μ΄ μλλΌ μ€μ λΉμ μ¬μ©ν λ κΉμ§ μ΅λν μμ±μ μ§μ°μ²λ¦¬ νλ μ§ μ¬λΆ
- InitMethodName : λΉμ μμ±νκ³ , μμ‘΄κ΄κ³λ₯Ό μ μ©ν λ€μ νΈμΆλλ μ΄κΈ°ν λ©μλ λͺ
- DestroyMethodName : λΉμ μλͺ μ£ΌκΈ°κ° λλμ μ κ±°νκΈ° μ΄μ μ νΈμΆλλ λ©μλ λͺ
- Constructor arguments, Properties : μμ‘΄κ΄κ³ μ£Όμ μμ μ¬μ©ν¨. (μλ° μ€μ μ²λΌ ν©ν 리 μν μ λΉμ μ¬μ© μμλ μμ)
" BeanDefinition μ μ§μ μμ±ν΄μ μ€νλ§ μ»¨ν μ΄λμ λ±λ‘ν μλ μμ§λ§ μ€λ¬΄μμ κ·Έλ¬ν κ²½μ°λ κ±°μ μλ€κ³ νλ€. BeanDefinition μ λν΄μλ μ€νλ§μ΄ λ€μν ννμ μ€μ μ 보λ₯Ό BeanDefinition μΌλ‘ μΆμνν΄μ μ¬μ©νλ κ²μ κΈ°μ΅νμ. "
Reference