Search code examples
javaspringspring-bootspring-cloud

Spring Boot application does not load spring.factories


I initialized a new project with Eclipse Spring boot and created the spring.factories file under src/main/resources/META-INF. On startup the configured bean does not get loaded.

Spring.factories:

org.springframework.cloud.bootstrap.BootstrapConfiguration=\
net.conjur.config.ConjurConfiguration,\
net.conjur.config.ConjurPropertySourceLocator

My application class got some annotations:

@SpringBootApplication
@SpringBootConfiguration
@EnableAutoConfiguration

As an example one of the beans looks like this:

@Configuration
public class ConjurConfiguration {
@Bean
public ConjurPropertySource getConjurPropertySource() {
return new ConjurPropertySource();
}
}

I already tried this:

  1. moving the META-INF folder in the project into different places, but without any luck.
  2. I tried to load the file from the main Application using the resource loader, but also no success

Solution

  • Processing of Bootstrap configuration is disabled by default in Spring Cloud 2020.0 and later. To re-enable it, set spring.cloud.bootstrap.enabled=true.