-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f9cd877
commit e3b0e4f
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/test/java/hello/core/beandefinition/BeanDefinitionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} | ||
} |