:::: 개발 ::::/└ JSP & SPRING

spring boot 로딩된 bean 목록 출력 소스...

nayha 2020. 11. 13. 14:21

이클립스에서 분명 사용하는 bean  리스트를 본것 같은데.. 아무리 찾아도 안나옴..

 

그래서 로딩된  bean  목록 출력하는것 소스

 

    import org.springframework.beans.factory.support.DefaultListableBeanFactory;
    
    
    public class RestController {
        
    @Autowired
    private DefaultListableBeanFactory dfBean;
    
    
    @GetMapping("/webportalif/getbean")
    public void getBean () {
        for(String name : dfBean.getBeanDefinitionNames()) {
            log.info(" INFO BEAN NAME ===  "+name);
        }
    }
    
    }
    
    출력..
    
11:28:21.157 [http-nio-8080-exec-6] INFO   c.m.w.r.interceptor.WebInterceptor.preHandle 43  - Request URI:/webportalif/getbean, method:GET
11:28:21.158 [http-nio-8080-exec-6] INFO   c.m.w.rest.controller.RestController.getBean 42  -  INFO BEAN NAME ===  org.springframework.context.annotation.internalConfigurationAnnotationProcessor
11:28:21.158 [http-nio-8080-exec-6] INFO   c.m.w.rest.controller.RestController.getBean 42  -  INFO BEAN NAME ===  org.springframework.context.annotation.internalAutowiredAnnotationProcessor
11:28:21.158 [http-nio-8080-exec-6] INFO   c.m.w.rest.controller.RestController.getBean 42  -  INFO BEAN NAME ===  org.springframework.context.annotation.internalCommonAnnotationProcessor
11:28:21.158 [http-nio-8080-exec-6] INFO   c.m.w.rest.controller.RestController.getBean 42  -  INFO BEAN NAME ===  org.springframework.context.event.internalEventListenerProcessor
11:28:21.158 [http-nio-8080-exec-6] INFO   c.m.w.rest.controller.RestController.getBean 42  -  INFO BEAN NAME ===  org.springframework.context.event.internalEventListenerFactory
11:28:21.158 [http-nio-8080-exec-6] INFO   c.m.w.rest.controller.RestController.getBean 42  -  INFO BEAN NAME ===  restApplication
11:28:21.159 [http-nio-8080-exec-6] INFO   c.m.w.rest.controller.RestController.getBean 42  -  INFO BEAN NAME ===  org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory
11:28:21.159 [http-nio-8080-exec-6] INFO   c.m.w.rest.controller.RestController.getBean 42  -  INFO BEAN NAME ===  webServiceConfig
11:28:21.159 [http-nio-8080-exec-6] INFO   c.m.w.rest.controller.RestController.getBean 42  -  INFO BEAN NAME ===  restController

반응형