Search code examples
javaspringspring-boot

Spring Boot 3.1.2 Not able to identify one of the configuration class from another library


I have the plain spring boot application and for logging that depends on the other maven library which is developed by me only. This setup was working for spring boot version 2.7 but now I want t o upgrade my application to Spring Boot 3.X.X. In this set up the configuration class which is there in the logging library is getting completely ignored. Below is my class and configurations.

package com.abc.xyz.sample;

@SpringBootApplication
public class ExampleConsumerApp {

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

My logging library have below configuration class.

package com.abc.xyz.logging

@Configuration
public class LoggingConfiguration {
    @Bean
    public LoggingBean getLogginBean() {
        return new LoggingBean();
    }
}

Configuration class is getting completely ignored. Can anyone help in this?

Thanks.


Solution

  • Got the Solution is Spring.factories is no more the correct way for Auto configuring. You need to add org.springframework.boot.autoconfigure.AutoConfiguration.imports inside META-INF/spring and put all your classes in it without comma or anything else.

    for e.g. com.abc.xyz.logging.LoggingConfiguration

    Spring doc for your reference Spring 3 Docs