Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 411
tzortzik Avatar asked Nov 07 '15 09:11

tzortzik


Video Answer


1 Answers

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");
        }
    }
}
like image 93
Ortomala Lokni Avatar answered Oct 18 '22 18:10

Ortomala Lokni