I'm trying to create spring based application but after the build i'm getting exception while initializing the spring context -> No auto configuration classes found in META-INF/spring.factories
.
I'm working heavily with spark in my application and i'm forced to use maven-assembly-plugin
to package my jar (otherwise i'm unable to run spark job).
sample of my main class:
@SpringBootApplication
@EnableAutoConfiguration
public class MyMainClass {
public static void main(String[] args) {
ConfigurableApplicationContext ctx = new SpringApplicationBuilder(MyMainClass.class).web(false)
.run(args);
SparkJob job = ctx.getBean(SparkJob.class);
job.prepareJobAndRun();
ctx.close();
}
}
when i add
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.mypackage.MyMainClass
everything works as expected, but i don't want to add them manually.
Any chance to make this work without the spring-boot-maven-plugin
?
I was able to found out, that you can add your own META-INF/spring.factories
to src/main/resources
. This custom spring.factories will be then packed to jar. Tested, working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With