Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
[ch07] ListBeanNameTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongho Sim committed Nov 18, 2017
1 parent 21679a2 commit 2255262
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/test/java/ch07/springbook/ListBeanNameTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package ch07.springbook;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.AppContext;

import test.TestAppContext;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AppContext.class, TestAppContext.class})
public class ListBeanNameTest {

@Autowired
private DefaultListableBeanFactory beanFactory;

@Test
public void beanListTest() {
for (String beanName : beanFactory.getBeanDefinitionNames()) {
System.out.println(beanName + " \t" + beanFactory.getBean(beanName).getClass().getName());
}
}
}

0 comments on commit 2255262

Please sign in to comment.