Using SpringApplication.run(Class<?> primarySource, String... arg)
worked for me. E.g.:
@SpringBootApplication
public class YourApplication {
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(YourApplication.class, args);
}
}