Open
Description
SpringApplication
makes it hard to get hold of the application context before it's refreshed. @michael-simons came up with this:
SpringApplication springApplication = new SpringApplication(Application.class);
springApplication.addInitializers((GenericApplicationContext ctx) -> {
ctx.registerBean(Greeter.class, Greeter::new);
});
springApplication.run(args);
It would be nice if the initialiser wasn't needed and the API provided an easier way to access the context before it's refreshed.