I have the following setup
- tokenmanager.jar
- SecurityService.class
- MyService.class (@Inject SecurityService)
- META-INF
- beans.xml
- MyApplication.war
- SecurityServiceProducer.class
- WEB-INF
- beans.xml
- web.xml
- lib
- tokenmanager.jar
The idea is that the application can decide how the SecurityService is composed and injected in the classes of the tokenmanager. So the tokenmanager.jar could be used by several teams with their own injections of dependencies. However the SecurityServiceProducer is never used on startup. I'm making use of liberty 20.0.0.x as server environment (with the addendum that everything still needs to run on WAS 8.5.5.9). For that reason I'm still forced to be using beans 1.0
beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>
Producer
import javax.inject.Inject;
import javax.ws.rs.Produces;
public class SecurityServiceProducer {
@Inject
@RedisTokenStoreQualifier
private TokenStoreDao tokenStoreDao;
@Inject
@AdfsIdentityProviderServiceQualifier
private IdentityProviderService identityProviderService;
@Inject
private SecurityServiceFactory securityServiceFactory;
@Produces
public SecurityService producer() {
return securityServiceFactory.produce(tokenStoreDao, identityProviderService);
}
}
I tried several steps already
Can anyone point me to something else I overlooked ?
For the @Produces
annotation, you're using javax.ws.rs.Produces
instead of javax.enterprise.inject.Produces