All Questions
119 questions
0
votes
1
answer
78
views
Bean injection into Hibernate BeforeExecutionGenerator
I'm using Hibernate's BeforeExecutionGenerator together with IdGeneratorType annotation to generate custom ids for my entities.
How could I inject some beans (or config properties) into my ...
0
votes
2
answers
82
views
Quarkus Test. Reset bean state
I have a stateful bean and some different test cases under @QuarkusTest for it. But each test case requires clean bean state for correct execution (tests should not depend on each other).
Currently ...
0
votes
0
answers
153
views
Quarkus CDI failing to find ApplicationScoped bean during quarkus-maven-plugin
I've created a simple Quarkus application that interacts with a backend database, using the repository pattern and a scheduled bean to count the records in the database on a regular basis. During ...
1
vote
2
answers
172
views
Quarkus check for bean injection point during maven package phase causing Unsatisfied dependency for type
I develop an extension that provide Injectable bean with a SyntheticBeanBuildItem.
This bean is used via constructor injection in another projet that use this extension.
/**
* Bean to inject
*/
@...
0
votes
1
answer
426
views
Quarkus Bean initialization order
I have a situation where one of my classes needs to perform some initialization tasks when the application starts up. This class depends on another component that also needs to be initialized at ...
1
vote
1
answer
79
views
Generic enum bean producer
I'm trying to write a generic enum producer;every injection point declare a different enum-type and value is resolved againts a set of values declared elsewhere (not so important).
I'm stuck writing ...
0
votes
0
answers
73
views
Quarkus Arc blocks Multi-Module Build in case of unset Properties in Module Build
I have a Quarkus Multi-Module Project (with Gradle), with following projects:
Core
Module1
Service1
Module1 contains an @ApplicationScope class that defines following Variable:
@Inject
@DataSource(&...
0
votes
0
answers
60
views
Dynamic bean registration Quarkus
Is there any way to initialize bean dynamically through runtime in Quarkus like it's in Spring https://www.baeldung.com/spring-5-functional-beans
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ...
1
vote
0
answers
105
views
quarkus smallrye reactive messaging - unittest
I'm trying to implement a small unittest, here I have 3 methods:
@ApplicationScoped
public class MyReactiveMessaging {
@Outgoing("from-producer-to-processor")
public ClassA produce()...
-1
votes
1
answer
119
views
Quarkus CDI: lookup and startup event
Starting from the code in the official documentation, I have created the following structure:
interface Service {
String name();
}
@LookupIfProperty(name = "service.foo.enabled", ...
1
vote
0
answers
216
views
Quarkus: is there a way to register bean without any @Produces and other annotations?
Is there a way to register bean into bean container without any annotation like @Producer, @ApplicationScoped and so on?
I know there is a way to do it in Spring, but I can't find any way how to do it ...
0
votes
1
answer
336
views
My custom interceptor is not being executed in Quarkus
I am writing a small app in Quarkus. I am mostly using the quarkus-hibernate-reactive-rest-data-panache extension. One thing is that it doesn't support a partial search for query params. So for ...
0
votes
1
answer
934
views
How to make a CDI bean eagerly initialized in Quarkus app
There is the project with quarkus 1.2.1 + jakarta cdi 2.0.2.
I've added a listener for SQS messages.
The problem is that all the beans are created lazily by default that is obviously not suitable for ...
0
votes
1
answer
1k
views
Quarkus: Inject/Use CDI bean inside a non-CDI bean
I'm trying to inject my singleton bean into a non-bean class, but for now, I always get that my injected dependency is null.
Quarkus: 3.2.2
@Named("singletonConfiguration")
@Singleton
public ...
0
votes
0
answers
532
views
quarkus, @produces interface with multiple implementation
So I have one interface:
public interface GService {
String doIt();
}
2 implementations:
@ApplicationScoped
public class GServiceBImpl implements GService {
@Override
public String doIt() ...
0
votes
1
answer
83
views
Microstream 8 CDI @Store type
Looking at a blog: https://openliberty.io/blog/2022/05/03/microstream-cdi-ext.html
This example mentions the annotation type @Store.
I'm using version 8 with JarkartaEE 10 and microprofile 6 so I'm ...
0
votes
0
answers
433
views
Field injection in Quarkus
I understand why Field Injection of CDI beans is not recommended in Spring (via @Autowired annotation). In Quarkus, however, this is a common practice (via @Inject annotation).
Why is Field Injection ...
0
votes
1
answer
312
views
Unsatisfied dependency for type MongoClient and qualifiers [@Default]
I've been struggling on the problem for 2 days already. I can't understand why CDI fails to inject MongoClient in my code:
package edu.kmaooad.capstone23.relations.dal;
import com.mongodb.client....
0
votes
1
answer
163
views
Warning: Unable to register kotlin.Lazy for reflection using Quarkus
I have the following data class in my Kotlin code that uses Quarkus as a server side framework.
data class Location(
val id: String,
val serviceTimeInMinutes: Long,
val openingTimes: List&...
1
vote
0
answers
91
views
What scope should be used for ResteasyClient?
I am a bit confused about the proper scope of ResteasyClient in Quarkus. Based on the Quarkus documentation, the default scope for ResteasyClient is @Dependent which is bound to the bean injecting it, ...
0
votes
0
answers
578
views
Is it possible to define an interceptor on an interface in Quarkus?
In my working on an application using Quarkus and I want to intercept a method of an interface. I tried the following but its not working:
First of all I define an annotation:
@Target({ TYPE, METHOD ...
1
vote
1
answer
1k
views
Quarkus CDI not working when creating a library
I have two projects A and B in project B and i want to injcet a CDI bean from project A however, this fails due too
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build ...
1
vote
1
answer
104
views
Is it possible to create a CDI Event factory?
On my quarkus app i have a application scope service with a lot of cdi event injections
@ApplicationScoped
public class SomeService {
@Inject
Event<EventA> eventAEmitter;
@...
5
votes
1
answer
5k
views
ERROR Couldn't find type javax.enterprise.context.ApplicationScoped. Are you missing a dependency on your classpath?
I'm writing Backend using Quarkus. Below is my POM.xml file:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/...
2
votes
2
answers
409
views
How to inject beans in QuarkusTestResourceLifecycleManager implementations
I try to implement a QuarkusTestResourceLifecycleManager implemenation which injects/looks up a bean in ArC, however the bean is not found.
public class FlywayTestResource implements ...
1
vote
0
answers
161
views
My custom "cdi" context is not getting applied/ called
I have a custom @InjectableContext which I register during my build step
@BuildStep
ContextConfiguratorBuildItem registerContext(ContextRegistrationPhaseBuildItem contextRegistrationPhase) {
...
0
votes
1
answer
207
views
Custom InjectableContext cannot differ between two injection points within the same bean in Quarkus
I try to implement a @TenantScope which can be used for stateful beans rather than using a nested map. For this I am implementing a io.quarkus.arc.InjectableContext.
I have it working so far, except ...
0
votes
0
answers
314
views
What is the effect of adding `@RequestScoped` to a method in Quarkus?
I have a Quarkus project which uses JDBI (and Kotlin,) and implements a DAOUtils class for producing its various DAOs.
@ApplicationScoped
class DAOUtils(
@DataSource("user") userDataSource:...
0
votes
1
answer
370
views
How to dynamically select a bean with multiple annotation
Let's say I have several processors classes and each processor is able to handle one or two specific keys. I'm reading a file made of csv lines and each line has a key in one of the fields.
Then ...
5
votes
1
answer
2k
views
Java Quarkus how can I pass @ConfigProperty to an constructor?
I have the following class:
@ApplicationScoped
public class AppScopeTest {
@ConfigProperty(name = "my-config-prop")
String test;
private TestClass testclass;
@Inject
...
2
votes
0
answers
283
views
How do I get CDI to work with quarkus when using a gradle composite build?
I can't get quarkus CDI to work when using a gradle composite build
Gradle 8
Quarkus 2.16.2.Final
Here is my super simple DI code.
First, the Bean I want to inject in the library:
//file: libraries/...
2
votes
0
answers
2k
views
Error with Quarkus CDI, Injection of inherited class
I am attempting to implement dependency injection in a class that is inherited from a base abstract class, and I get the following error: "javax.enterprise.inject.spi.DeploymentException: It's ...
0
votes
0
answers
607
views
share request context between threads
I have a Quarkus app with REST API and multiple services that are @ApplicationScoped, and one bean that is @RequestScoped (it has data related to JWT, cookies etc).
When the REST API is invoked, I ...
0
votes
1
answer
75
views
Managing object construction in Quarkus CDI
I have a custom Logger that internally uses the jboss logger:
@Dependent
class LogImpl implements Log { //LogImpl & Log are custom
@Inject
Logger sink; // this is jboss logger
...
}
I ...
0
votes
0
answers
1k
views
Quarkus CDI Bean is not injected / is null
I have a simple quarkus backend application. I am using CDI dependency injection in many places. Normally it works fine. But in one case the dependant bean is not injected. Its null. Why?
The bean I ...
0
votes
0
answers
260
views
Should Kotlin's suspend function be allowed for valid CDI Producers / Beans
According to Jakarta's CDI 2.0 (and 4.0 as well) spec:
https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#producer_method
If a producer method return type contains a wildcard type parameter ...
0
votes
1
answer
131
views
Is there an @After advice Spring equivalent in Quarkus?
In a Quarkus application, I want to fire events with the results of a method, and we think the equivalent of an @After advice in Spring, which:
"runs after the target method is finished, ...
0
votes
0
answers
248
views
Unsatisfied Dependency in Quarkus
i have got a Rest Controller which was genereated with Openapi (kotlin client), thus meaning, that i am not allowed to change the code inside the controller.
I have got another class which injects the ...
0
votes
1
answer
287
views
Ensure the `@ServerRequestFilter` method runs before the `@Produces` method of a class in Quarkus
I have a class that essentially looks like this. I have found that the order of the methods annotated with @ServerRequestFilter and @Produces is indeterminent. However, the method annotated with @...
1
vote
2
answers
728
views
Keep @RequestScoped context when receiving an async CDI event
I want to switch from firing CDI beans synchronous to asynchronous to be able to work stuff parallel.
event.fire(myObject) -> event.fireAsync(myObject)
As I currently use the request context to ...
0
votes
1
answer
377
views
Quarkus multi-module cyclic reference problem
This is my first project using Quarkus.
I made a multi-module project and in the parent pom I have this module structure:
<modules>
<module>domain</module>
<...
1
vote
1
answer
513
views
Quarkus - @Inject Logger causes NPE in test while using Mockito extension; @QuarkusTest works fine
org.jboss.logging.Logger with @Inject annotation in my code causes NullPointerException in my unit test annotated with @ExtendWith(MockitoExtension.class), if I define it as a org.mockito.@Mock. It's ...
1
vote
1
answer
2k
views
Passing in parameters with constructor injection
I am working on an app where an endpoint is being called to add a user. This calls a service class (that has been injected into the controller class) to add the user. In the service class I have ...
0
votes
0
answers
769
views
Lookup by Arc.container().instance using TypeLiteral not working (quarkus)
I try to look up bean programatically using ArC.
I built the following:
public class ServiceLookup {
public static <T extends Service> T get(Class<T> clazz, JobType jobType){
...
0
votes
2
answers
1k
views
Override beans from an external library (Quarkus)
I want to override a bean that's used by Quarkus to disable authentication/authorization.
With the following implementation, it works that REST endpoints can be configured at start time to not be ...
1
vote
2
answers
2k
views
How to get beans with custom annotation via ArC in quarkus?
I want to find beans at runtime depending on user input, so using io.quarkus.arc.Arc.
However, I cannot figure out how to get beans with custom annotation in a reasonable way. Only got something ...
1
vote
0
answers
2k
views
Quarkus framework provides some annotation for inject a bean depend of the property value?
Hi guys I have a doubt I am trying to inject or only initialize filter request only when a property value is enabled.
When the value es false this filter not will be inject o intercept requests.
For ...
2
votes
1
answer
6k
views
How does RequestScope in Quarkus/CDI work?
I did some experimentation with Quarkus and I am having difficulties understanding how @RequestScoped works. Coming from Spring, I would be expecting that the following code should not work and throw ...
0
votes
0
answers
264
views
Injection of a Interface that Inherits from a Bean
I'm trying to create a custom MongoDB Repository that will handle transactions that are related to the business context only.
Since I want to expose these functions trough a interface, I'm having some ...
1
vote
0
answers
618
views
Java CDI: @Decorator gets recursively called
Problem
I'm currently building an application using Quarkus (2.9.2.Final). The project contains multiple modules that depend on each other. The usecase module contains the interfaces for the ...