Skip to content
Advertisement

Tag: cdi

What is the name of the design pattern where I dynamically pick the correct implementation based on data?

Originally I picked the correct User implementation, based on domain and realm data from the Java EE server. However that was company code, so I had to rewrite the example with numbers. I hope the underlying pattern is still understandable though. For those unfamiliar with CDI, @Inject Instance allows you to iterate through all implementations of an interface. Answer I

How to unit test methods together with its constraint validators (which some should be mocked out)?

My app has a service layer which is composed by CDI applications scoped beans: When a method gets called, an interceptor (in my case BValInterceptor.class from Apache BVal) checks if the method contract is respected by checking the annotations and validating the parameters accordingly. As you can see, there are some custom constraints like @SectionExists, @PostExists that may hit the

Interface CDI wildfly external projects

So my idea is to have 3 projects: com.tests.interfaces com.tests.services com.tests.schedulers com.tests.interfaces basically is: com.tests.services is: I am deploying the “services” project and it works fine using wildfly 24.0.0. Then I am trying to have another .war project called: com.tests.schedulers which looks like this: But it cant be deployed and this is the relevant part of wildfly’s (same server to

Dependency injection with @Inject and Interface in Quarkus

I’m trying to resolve dependency injection with Repository Pattern using Quarkus 1.6.1.Final and OpenJDK 11. I want to achieve Inject with Interface and give them some argument(like @Named or @Qualifier ) for specify the concrete class, but currently I’ve got UnsatisfiedResolutionException and not sure how to fix it. Here is the my portion of code. UseCase class: Repository Interface: Repository

Spring 5.x and CDI 2.x Integration Options

Considering Spring’s 5.x baseline and CDI’s baseline 2.x, what more viable options should I consider to integrate them into a project with JSF 2.3, since JSF 2.3 is coupled with the CDI? Bridges? Custom Bean Factories? Others? Answer We use bean producers to access Spring objects in CDI. As in the architecture we used there is an interface layer between

CDI events fire() create new observers instances

I’m writing a JavaFX application (JavaSE) with CDI (Weld). I’m trying to use CDI Events to replace the awful event system of JavaFX (JavaFX Properties). I was able to let CDI create my JavaFX controllers properly. It means that when a FXML is loaded, the controller is created by CDI (using FXLoader.setControllerFactory). Unfortunately as soon as I added an @Observes

Advertisement