So the first step is understanding how Groovy code and Java code can be used together. Groovy code can be called from Java code a couple of different ways...
1. Groovy classes are compiled to byte code. You can then include these classes in your classpath and treat them as first class Java citizens. So if you had a Groovy class called User you could simply say User user = new User() in Java.
2. Groovy scripts can be executed from Java code. It is possible to retrieve data from the script through the engine that you execute in Java.
There is really only 1 way to use Java code from groovy and that is to have the classes in your classpath when executing Groovy code.