Example:
@Component
class Example implements CommandLineRunner {
@Autowired
MyService myService
void run(String... args) {
println "Hi There"
}
}
beans{
myService(MyService)
}
class MyService { }
and executing:
works as expected. But if I do the jar
$ spring jar myjar.jar app.groovy
$ java -jar myjar.jar
I got:
java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoClassDefFoundError: org/springframework /boot/BeanDefinitionLoader$GroovyBeanDefinitionSource