According to what Donal said, you can associate a Java class with a bean in .groovy resources
For example, suppose the name of your java class is JavaClass, and it is located somewhere in your src folder. Go to resources.groovy and add the following to your beans ...
beans = { ... javaClass(JavaClass) { exampleService = ref('exampleService') } }
You should now have access to exampleService inside your java class, like a regular bean.
def exampleService
Although keep in mind that if you use something like intellij, a small bean icon may not appear next to it. This is normal. Also, be sure to import JavaClass into resources.groovy
source share