It already works in the typical case where the main application class is also the class that's annotated with @SpringBootApplication. However, it fails when the two are separated like this:
package com.example.demonativesample;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.Bean;
public class DemoNativeSampleApplication {
public static void main(String[] args) {
SpringApplication.run(SeparateConfigurationClass.class, args);
}
@SpringBootApplication
static class SeparateConfigurationClass {
@Bean
public String one() {
return "one";
}
}
}