I'm building a fat jar using spring boot , the fat jar works using
java -jar app.jar
the problem is that I'm using docker and I want to expand the jar contents for better usability , I do the following to extract :
unzip app.jar
now I run the jar with the following :
java -cp "." org/springframework/boot/loader/JarLauncher
I get the following error :
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxRsServer' defined in class path resource
so it couldn't find my bean altough it's configured :
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
@ImportResource("classpath:spring/beans_context.xml")
public class SpringBootJaxrsApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootJaxrsApplication.class, args);
}
}
beans_context.xml :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:annotation-config />
<import resource="classpath:META-INF/spring/*_context.xml"/>