run spring boot with kscript
See original GitHub issueI tried running
#!/usr/bin/env kscript
@file:DependsOn("org.springframework.boot:spring-boot-starter:2.0.4.RELEASE")
package my.package
import DependsOn
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.SpringApplication
@SpringBootApplication
class DummyApp
SpringApplication.run(DummyApp::class.java, *args)
it starts but fails with
ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.
at org.springframework.util.Assert.notEmpty(Assert.java:450)
A comparable groovy/@Grab script with the same setup works, so I wonder if this is something that can/will never work with kscript due to design or is just a missing feature that can be achieved … somehow
I know that running complex spring boot apps with kscript seems to be out of scope, but I have quite a experimental microservices that require minimal coding and would benefit from a scripting approach …
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
62. Installing Spring Boot Applications
In addition to running Spring Boot applications by using java -jar , it is also possible to make fully executable applications for Unix...
Read more >Scripting in Kotlin with kscript - Fredrick Biering
The project was an app built with Kotlin and Spring Boot. ... want to do is to put a piece of code into...
Read more >Issues · kscripting/kscript - GitHub
Contribute to kscripting/kscript development by creating an account on GitHub. ... kscripting / kscript Public ... run spring boot with kscript help wanted....
Read more >Starting Spring boot applications from script - Stack Overflow
Using normal spring mvn commands, I can start a spring boot application from command line and terminate it with Control+c.
Read more >Available SDKs - SDKMAN! the Software Development Kit ...
BTrace can be used to dynamically trace a running Java program (similar to ... Spring Boot takes an opinionated view of building production-ready...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I actually love the use-case.
It’s not working for me either. It’s because we don’t use spring’s custom packaging method.
The problem seems to center around the missing
META-INF/spring.factories
. However, even if I patch the jar created by kscript internally to include the file, it fails with the same error. So to progress here, we’d need to find a way to provideMETA-INF/spring.factories
via classpath. It seems partially documented under https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-developing-auto-configuration.html#boot-features-developing-auto-configuration In particular is saysSo if we could find a way to run a spring-app without their deployment-scheme by providing an extra-jar that adds the missing
META-INF/spring.factories
the classpath, we could configurekscript
to run it accordingly.I’m not so sure. Whenever a custom build-file is required (e.g. doing something like
apply plugin: 'org.springframework.boot'
) than we will struggle doing this in kscript, since we can not (and do not really want to) mess with the build beyond classpath and compiler settings.I personally find it an odd design choice by the spring people to force users to use a custom build-plugin.