How to handle 'Rejected bean name - no URL paths identified' in Spring?

后端 未结 1 1890
情话喂你
情话喂你 2021-01-07 20:12

I have a Spring Boot Application and I get at launch time the following messages:

7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name          


        
相关标签:
1条回答
  • 2021-01-07 21:02

    As said in the comments, this is a debug message and no actions need to be taken.

    For those interested, here are some details:

    At startup a HandlerMapping is run to determine a mapping between requests and handler objects. The AbstractDetectingUrlHandlerMapping class has a detectHandlers method that register all handlers found in the current ApplicationContext. When iterating over beans, the beans for which no URL paths are identified, are rejected.

    Here is the corresponding code :

    // Take any bean name that we can determine URLs for.
    for (String beanName : beanNames) {
        String[] urls = determineUrlsForHandler(beanName);
        if (!ObjectUtils.isEmpty(urls)) {
            // URL paths found: Let's consider it a handler.
            registerHandler(urls, beanName);
        }
        else {
            if (logger.isDebugEnabled()) {
                logger.debug("Rejected bean name '" + beanName + "': no URL paths identified");
            }
        }
    }
    
    0 讨论(0)
提交回复
热议问题