spring - Spring如何处理 'Rejected bean name - no URL paths identified'?

标签 spring url 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

我在应用中使用的每个 @Autowired 都会发生这种情况。

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

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

知道为什么我会收到这些消息吗?

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

这些是我的 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")
}

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

最佳答案

正如评论中所说,这是一条调试消息,无需采取任何措施。

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

在启动时运行 HandlerMapping 以确定请求和处理程序对象之间的映射。 AbstractDetectingUrlHandlerMapping 类有一个 detectHandlers 方法,用于注册在当前 ApplicationContext 中找到的所有处理程序。迭代 bean 时,没有标识 URL 路径的 bean 将被拒绝。

这里是对应的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");
        }
    }
}

关于spring - Spring如何处理 'Rejected bean name - no URL paths identified'?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33581039/

相关文章:

java - 如何根据 Java 中给定的一组比较器对作为字符串的 TreeMap 键进行排序

java - Spring-Cloud-Stream 仅在应用程序启动时实现的状态存储已完全填充并准备就绪后才处理 kafka 消息

java - Spring boot - Snowflake JDBC - 应用程序加载时自动更改 session

spring-boot - Spring Data Neo4j 6 中的@Transactional

java.io.FileNotFoundException : [WEB-INF/spring-servlet. xml] 无法打开,因为它不存在

java - Spring session ,部署后从 "local class incompatible"恢复

java - Form Action属性错误struts2

javascript - AngularJS $location.path 未按预期工作

Javascript URL参数传递和接收

java - Stripes 1.6 缺少 Spring Interceptor