This message was deleted.
# questions
s
This message was deleted.
s
I'm not 100% sure of the magic of how this works myself, but in one case I needed to declare the methods in an interface, and implement the interface on the abstract class where the annotation is added. Does something like this work?
Copy code
interface ITagService {

    Tag findOrCreateByLabel(String label)

}

@Service(Tag)
abstract class TagService ITagService  {

}
s
good suggestion, but that does not seem to work. I could be missing some obvious parts, because I have read and only partially follow the docs (and not super savvy about spring, annotations, and how the annotation and abstract class all work together 🙂
👍 1
Here are my files for reference (or future seekers):
The odd part is that those calls work for the
find
part, but return null for the create/save parts. It makes me think perhaps it is a bug in my version (5.2.4) of grails? I will see about testing a more recent version in the next couple of days. I just really wrestled with getting 5.3+ working, and 6 was "right out" for me. Perhaps I've learned/remembered enough now to try again : -)
fwiw, this "works" (in the abstract class implementing the interface ^^^):
Copy code
@Override
    Tag findOrSaveByLabel(String label){
        Tag t = Tag.findOrSaveByLabel(label)
        if(t==null){
            log.warn "No tag:$t (labeL: $label)"
        }
        return t
    }
but it feels like I am missing the 'DRY' approach. c'est la vie...