如何在Spring中处理'拒绝的bean名称 - 没有识别的URL路径'?

tzo*_*zik 19 url spring spring-boot

我有一个Spring Boot应用程序,我在启动时得到以下消息:

7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalRequiredAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalCommonAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.internalPersistenceAnnotationProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'application': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor': no URL paths identified
7701 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor': no URL paths identified
7702 [main] DEBUG o.s.w.s.h.BeanNameUrlHandlerMapping - Rejected bean name 'bookingController': no URL paths identified
Run Code Online (Sandbox Code Playgroud)

@Autowired我在我的应用程序中使用的每一个都会发生这种情况.

我的应用程序的唯一配置是:

@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

为什么我收到这些消息的任何想法?

我尝试谷歌后,这些消息和其他人说,它可能是默认的注释处理程序和我没有定义的自定义注释处理程序之间的冲突.

这些是我的gradle依赖

dependencies {
    compile('org.springframework.boot:spring-boot-autoconfigure')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile("org.springframework.boot:spring-boot-starter-data-rest")
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.6.1')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile("mysql:mysql-connector-java:5.1.34")

    testCompile("junit:junit")
    testCompile("org.springframework.boot:spring-boot-starter-test")
    testCompile("com.jayway.jsonpath:json-path")
    testCompile("com.jayway.jsonpath:json-path-assert:0.9.1")
}
Run Code Online (Sandbox Code Playgroud)

在我的类路径中,我没有任何可能出现这种情况的设置.

Ort*_*kni 21

如评论中所述,这是一个调试消息,不需要采取任何操作.

对于那些感兴趣的人,这里有一些细节:

在启动时,运行HandlerMapping以确定请求和处理程序对象之间的映射.该AbstractDetectingUrlHandlerMapping类有一个detectHandlers方法是注册在当前ApplicationContext中发现的所有处理程序.在遍历bean时,将拒绝未标识URL路径的Bean.

这是相应的代码:

// 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");
        }
    }
}
Run Code Online (Sandbox Code Playgroud)