Replies: 1 comment
-
After some playing around with it I was able to get it to work using this: @Dependent
public class AstraConfig {
private static final String ASTRA_SERVICE_IMPL_PROPERTY_NAME = "astra-service.type";
@Produces
@ApplicationScoped
@IfBuildProperty(name = ASTRA_SERVICE_IMPL_PROPERTY_NAME, stringValue = "cql-session", enableIfMissing = true)
public AstraService cqlSessionAstraService(QuarkusCqlSession cqlSession) {
return new CqlSessionAstraService(cqlSession);
}
@Produces
@ApplicationScoped
@IfBuildProperty(name = ASTRA_SERVICE_IMPL_PROPERTY_NAME, stringValue = "dao")
public AstraService mapperAstraService(TodoItemDao todoItemDao, TodoMapper todoMapper) {
return new MapperAstraService(todoItemDao, todoMapper);
}
} Seems you need to set the scope on the producer methods. It also seems that the beans being created can't I think the guide needs to be updated accordingly. Can someone please confirm this is the case? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was trying to follow this guide - https://quarkus.io/guides/cdi-reference#enable_build_properties
I built this:
The classes
CqlSessionAstraService
andMapperAstraService
implement theAstraService
interface (an interface in my application). Neither class has any annotations on them. They do@Inject
some things though.But when I try and build the app I get the following error. NOTE: I did try using
@DefaultBean
instead of@IfBuildProperty(name = ASTRA_SERVICE_IMPL_PROPERTY_NAME, stringValue = "cql-session", enableIfMissing = true)
but that didn't change anything.I also tried this - but same got the result:
Beta Was this translation helpful? Give feedback.
All reactions