Skip to content

ClassNotFoundException when running a CLI jar that has 'beans { }' configuration #594

@felipeg48

Description

@felipeg48

Example:

@Component
class Example implements CommandLineRunner {

@Autowired
MyService myService

void run(String... args) {
    println "Hi There"
}
}

beans{
myService(MyService)
}

class MyService { }

and executing:

$ spring run app.groovy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions