I'm trying to connect to two different JCR (ModeShape) repos in my app, but based on current documentation and some testing, I'm not able to figure it out.
@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositorySessionQualifer
public Map<String, String> produceJcrConfig(@Resource("contentRepository.xml") URL url) {
String modeshapeUrl = url.toExternalForm() + "?repositoryName=ContentRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}
@Produces
@Named(ConfigParams.JCR_REPOSITORY_CONFIG_MAP)
@RepositoryEmailSessionQualifer
public Map<String, String> produceJcrConfig2(@Resource("contentRepository.xml") URL url) {
String modeshapeUrl = url.toExternalForm() + "?repositoryName=EmailRepository";
return Collections.singletonMap(MODESHAPE_URL, modeshapeUrl);
}
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean name is ambiguous. Name jcrRepositoryConfigMap resolves to beans [Producer Method [Map<String, String>] with qualifiers [@Any @RepositorySessionQualifer @Named] declared as [[method] @Produces @Named @RepositorySessionQualifer public com.parts.content.faq.metadata.JcrConfigProducer.produceJcrConfig(URL)], Producer Method [Map<String, String>] with qualifiers [@Any @RepositoryEmailSessionQualifer @Named] declared as [[method] @Produces @Named @RepositoryEmailSessionQualifer public com.parts.content.faq.metadata.JcrConfigProducer.produceJcrConfig2(URL)]]