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

匿名 (未验证) 提交于 2019-12-03 02:30:02

问题:

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 '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 

This is happening for every @Autowired I have used in my app.

The only configuration for my application is:

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

Any ideas why I get those messages?

I tried to google after those messages and others said that it may be a conflict between the default annotation handler and custom annotation handler which I have not defined.

Those are my gradle dependencies

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") } 

In my classpath I don't have any settings which may case this.

回答1:

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");         }     } } 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!