Maybe this is a question prone to be deleted, but just in case.
I've had a doubt lately while doing @EventListener
annotated methods on my services if those methods should be included on the service's interface or not.
I mean, with a class like:
class FooServiceImpl implements FooService {
@EventListener
public void doSomethingWithEvent(ApplicationEvent event){
// do something
}
}
Should doSomethingWithEvent
be included in FooService
?
I think it shouldn't as the method is not meant to be directly invoked by any other instance but the one managing the events.
But, on the other hand, I would have a public method on my service that is not included on the interface, and for some reason, that smells bad to me (maybe it's just a habit).
So, what to do? Is there any convention regarding this?