Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 ...
Andrei Yusupau's user avatar
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 ...
Andrei Yusupau's user avatar
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 ...
Robert K's user avatar
  • 488
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 */ @...
Scandinave's user avatar
  • 1,438
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 ...
BananKongen's user avatar
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 ...
Luca Basso Ricci's user avatar
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(&...
funkrusher's user avatar
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 = ...
Disteonne's user avatar
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()...
freedev's user avatar
  • 29.8k
-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", ...
Fabrizio Fortino's user avatar
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 ...
Disteonne's user avatar
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 ...
rjjdv's user avatar
  • 405
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 ...
Catalonec's user avatar
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 ...
Dmitry Sinyavskiy's user avatar
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() ...
Fabrizio Stellato's user avatar
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 ...
Jeff Rogers's user avatar
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 ...
Morlin's user avatar
  • 99
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....
Capy Maths's user avatar
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&...
greyhairredbear's user avatar
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, ...
khesam109's user avatar
  • 620
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 ...
khesam109's user avatar
  • 620
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 ...
santi254's user avatar
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; @...
Bentz's user avatar
  • 133
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/...
MightyThor's user avatar
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 ...
syr's user avatar
  • 934
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) { ...
Herr Derb's user avatar
  • 5,327
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 ...
Herr Derb's user avatar
  • 5,327
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:...
Cory Skowronek's user avatar
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 ...
Lbro's user avatar
  • 361
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 ...
santi254's user avatar
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/...
Jolleyboy's user avatar
  • 1,383
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 ...
Rafael F N Xavier's user avatar
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 ...
Bentz's user avatar
  • 133
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 ...
Keerthi's user avatar
  • 594
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 ...
Robert's user avatar
  • 1,779
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 ...
Robert Gonciarz's user avatar
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, ...
Chexpir's user avatar
  • 1,876
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 ...
strelok's user avatar
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 @...
Mambazo's user avatar
  • 175
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 ...
Herr Derb's user avatar
  • 5,327
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> <...
Clément Gibert's user avatar
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 ...
WesternGun's user avatar
  • 12.6k
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 ...
Dan's user avatar
  • 2,100
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){ ...
syr's user avatar
  • 934
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 ...
Japu_D_Cret's user avatar
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 ...
syr's user avatar
  • 934
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 ...
Roger Huamani's user avatar
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 ...
Dave's user avatar
  • 450
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 ...
Johnnes Souza's user avatar
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 ...
Michael Burgstaller's user avatar