This spring-boot-starter facilitates the debugging of your deployed web application. It allows you to execute arbitrary code in the context of your application or outside it via the web route.
- Java 11+
- Spring boot WEB application
- Add dependency in your project. See versions on Maven Central.
For maven project:
<dependency>
<groupId>dev.toliyansky</groupId>
<artifactId>evaluator-spring-boot-starter</artifactId>
<version>1.2.2</version>
</dependency>
For gradle project:
implementation 'dev.toliyansky:evaluator-spring-boot-starter:1.2.2'
- Since execution of arbitrary code is a security breach, the bean with route will not be instantiated by default.
You must enable the evaluator by adding this property to
application.properties
:
evaluator.enabled=true
evaluator.webUiEnabled=true
-
WEB UI: Use
http://host:port/eval
to access the web interface of evaluator with syntax highlight -
API: GET
http://host:port/eval/{language}?code={your code}
Parameters:
your code - string with a valid script, URI encoded
language - your script language [groovy, shell, cmd, powershell] -
API: POST
http://host:port/eval/{language}
language - your script language [groovy, shell, cmd, powershell]
request body - string with a valid script
WEB UI is a preferable way of a code execution. Use API requests when the route is not accessible outside of execution environment (ex. kubernetes cluster, you can connect to POD terminal and use curl/wget for execute code you need to run).
- Execution arbitrary code in runtime. Support languages:
- groovy
- java (by compatibility via groovy)
- shell
- cmd
- powershell
- UI with code and response highlight
You can use Shell, Cmd or PowerShell for execute scripts in system context.