Loading...
середа, 4 червня 2014 р.

Spring: how to print all bean names from ApplicationContext?

How to get all bean ids from the Spring Application Context and print to console. Needed sometimes for debugging purposes :)

1
2
3
4
5
6
7
8
9
public class PrintBeans {
    @Autowired
    ApplicationContext applicationContext;

    public void printBeans() {
        System.out.println(Arrays.asList(applicationContext.getBeanDefinitionNames()));
    }

}

0 коментарі:

 
TOP