Skip to content

Commit

Permalink
2022-12-26-Mon-20:46
Browse files Browse the repository at this point in the history
  • Loading branch information
liberalwig committed Dec 26, 2022
1 parent f9cd877 commit e3b0e4f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/test/java/hello/core/beandefinition/BeanDefinitionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package hello.core.beandefinition;

import hello.core.order.AppConfig;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;

public class BeanDefinitionTest {

//AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(AppConfig.class);
GenericXmlApplicationContext ac = new GenericXmlApplicationContext("appConfig.xml");

@Test
@DisplayName("Bean 설정 메타정보 확인")
void findApplicationBean() {
String[] beanDefinitionNames = ac.getBeanDefinitionNames();
for (String beanDefinitionName : beanDefinitionNames) {
BeanDefinition beanDefinition = ac.getBeanDefinition(beanDefinitionName);

if (beanDefinition.getRole() == BeanDefinition.ROLE_APPLICATION) {
System.out.println("beanDefinitionName = " + beanDefinitionName +
" beanDefinition = " + beanDefinition);
}
}
}
}

0 comments on commit e3b0e4f

Please sign in to comment.