I am trying to run my spring-boot app (using gradle and java) together with groovy classes.
So I added controller (as shown in the examples)
the controller is under src/main/groovy
@RestController
class ThisWillActuallyRun {
@RequestMapping("/")
String home() {
"Hello World!"
}
}
I also have my java classes under
src/main/java
Iam running spring boot using java -jar (or gradle in dev mode: bootRun)
Code is compiled but the groovy controller isnt loaded.
I miss some concept here about running groovy and java classes side-by-side on the same jar?
Thanks.
I think you forgot to apply the groovy gradle plugin. I have replicated your simptoms by creating a spring boot project with both java and groovy classes, and only applying the java plugin. To be able to include groovy classes in your application, replace
apply plugin: "java"
with
apply plugin: "groovy"
The groovy plugin subclasses the java plugin, so you will still able to compile java classes.
If that is not the case, you will have to provide more information, like the gradle build script. If you are using gradle.
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