'How to run a Groovy script in my Spring Boot Application?

So I have an existing spring boot app. I want to add a Groovy script (let's say "HelloWorld.groovy") to display the message hello world. how can i do this? below is how i want it took like :

// some random code here
// ...
// ...
// groovy script : "HelloWorld" to be executed
// some random code ...


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source