By default Errai is meant to discover RPC implementations through CDI. But Errai also has a standalone mechanism for discovering @Service implementations on the classpath. See the notes on service discovery in this section.
As I see it, here are your options:
- Use Errai's standalone service discovery. Your AuthenticationService will have to be default instantiable. If it depends on Spring managed objects, you will need to dynamically look them up.
- If Spring has an SPI, you could write an extension like the one we use for CDI. That CDI extension registers CDI beans that are @Service implementations of RPC interfaces with Errai (which would include AuthenticationService).
(1) is the quicker solution, but if you have other RPC services (or intend to add more) (2) will be more convenient in the long run.
I was just busy looking into this myself, and so just posting a link to this forum post, which I haven't tried out for myself, but mean to try somewhere in the next few weeks...
Seems the link I posted is quite out of date, not proving useful so far. So I'll be looking into the options mentioned by Max...
You can look at this post about a new spring errai github project: github project for errai spring server side integration
It has a sample Errai AuthenticationService that delegates to Spring Security, but I have not used it the otherway around as yet, to try and reuse a Errai AuthenticationService as a spring security implementation.