I just generated a WAR packaging app with spring boot initializer and here are the generated sources.
Main application class
@SpringBootApplication
public class ChargingListenerApplication {
public static void main(String[] args) {
SpringApplication.run(ChargingListenerApplication.class, args);
}
}
the servlet initializer class.
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ChargingListenerApplication.class);
}
}
How does Spring realize this class and run configure()? Is this just because of the type? If so isn't this a bit weird to handle like this, instead of a proper annotation? Plus, in Spring documentation they extend SpringBootServletInitializer
in the main class.