I just started a grails project and haven’t found how to work with services using dependency injections and interfaces.
As I have seen so far in the documentation when creating a service, this is just the groovy class, which can be automatically connected wherever I want.
But what if I want to have an interface for a service and implement one of its implementation, as it was in Java using spring?
for example, I want to have a service interface. let it be MyService.groovy it will have 1 doSmth () method and I will have 2 implementations - MyServiceImpl1.groovy and MyServiceImpl2.groovy
I have a quartz job doing something like this def myService myService.doSmth ()
Where should I put the groovy interface (folder)? Should I create a package for this in src / groovy? How to configure .groovy resources to connect "myService" to 1 service implementation?
Any thoughts appreciated
Thanks in advance!
source
share