cdi Questions

4

Solved

In Java EE 7, what's the purpose and use of @Named annotation here? Even without it, the container should be able to discover this bean at runtime, right? Also, what about the @Singleton do? If d...
Salcido asked 27/9, 2014 at 5:57

2

Solved

I've a CDI managed bean wherein I'd like to set request parameters as managed properties: import javax.inject.Named; import javax.enterprise.context.RequestScoped; @Named @RequestScoped public cl...

5

Solved

In a managed bean, @PostConstruct is called after the regular Java object constructor. Why would I use @PostConstruct to initialize by bean, instead of the regular constructor itself?
Mccarley asked 4/8, 2010 at 14:32

3

Solved

I have created a fresh new Java EE 6 Enterprise-Application in Netbeans 7.2. So I have three Projects: EAR EJB WAR In the EJB-Project, I have created a simple Bean: package de.aidaorga.test; ...
Bacchae asked 28/8, 2012 at 22:22

3

Solved

Let's suppose we have the following classes public abstract class AbstractFoo { @PostConstruct private void doIt() { // } } public class Foo extends AbstractFoo { @PostConstruct private v...
Numbersnumbfish asked 27/8, 2017 at 15:5

2

Is it possible to obtain an instance of a CDI bean inside a class that is created using the new keyword? We're currently making some enhancements on an old application, and we're always getting a C...
Handicap asked 19/2, 2015 at 7:6

2

Is there a way of detecting @Named CDI-Beans which are created with javax.faces.bean.ViewScoped? It happened multiple times to me, that the IDE preferred this annotation to javax.faces.view.ViewSco...
Antinomian asked 10/7, 2023 at 11:26

1

Solved

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/xs...
Radioactive asked 14/6, 2023 at 10:36

1

Solved

I have the following class: @ApplicationScoped public class AppScopeTest { @ConfigProperty(name = "my-config-prop") String test; private TestClass testclass; @Inject public AppSc...
Frayda asked 27/2, 2023 at 15:20

3

Solved

Can I (and if so, how?) lookup CDI managed beans using javax.naming.Context#lookup in EJB module? I'm using GlassFish v3. I suppose that I can use @Named, but what is JNDI name of CDI managed bean...
Stoss asked 17/11, 2011 at 11:16

2

Solved

This question took off because I read Arjan Tijms blogpost about JSF 2.3. There, he list all JSF artifacts which can be injected via CDI. Although HttpServletRequest is mentioned, HttpServletRespon...
Handbook asked 8/9, 2021 at 10:23

2

Solved

So, I have a basic Java SE program with dependency injection using Weld 1.2. Everything is working fine, until I throw Hibernate into the mix, with the following pom.xml dependency entries: <d...
Lipoma asked 11/9, 2014 at 22:19

9

Solved

I have found this question: What is the difference between @Inject and @EJB but I did not get any wiser. I have not done Java EE before nor do I have experience with dependency injection so I do no...
Slotter asked 15/11, 2011 at 14:52

4

Solved

I have faced with the following issue. I am using Weld implementation of the CDI. I have found that if a service is annotated with @ApplicationScoped then @PostConstruct section is not invoked unt...
Polynomial asked 14/3, 2018 at 13:19

7

Solved

I'm a Java EE-newbie. I want to test JSF and therefore made a simple program but can not deploy it. I get the following error message: cannot Deploy onlineshop-war deploy is failing=Error occurred...
Theoretician asked 5/2, 2015 at 19:32

6

Solved

Spring's @Autowire can be configured such that Spring will not throw an error if no matching autowire candidates are found: @Autowire(required=false) Is there an equivalent JSR-330 annotation? @In...
Unmentionable asked 21/10, 2013 at 3:35

0

Solution of this question already exists in stackoverflow. Although I have asked this question, it is because all available answers doesn't solve my problem/error. So I have asked this question so ...
Draught asked 2/11, 2021 at 13:5

18

Solved

When trying to reference a managed bean in EL like so #{bean.entity.property}, sometimes a javax.el.PropertyNotFoundException: Target Unreachable exception is being thrown, usually when a bean prop...
Aecium asked 8/5, 2015 at 16:15

3

Solved

CDI has the feature of Specialization, and I'm looking for that in the Spring world. Details. In CDI, the @Specializes annotation allows one to change the behaviour of a bean just by overriding it...
Schellens asked 13/11, 2014 at 15:33

7

Solved

I'm using Wildfly 10.0.0 Final, Java EE7, Maven and JPA 2.1. When I am querying my database for records it works fine and lists out the employees, but when I am trying to persist a new employee it ...
Dimension asked 5/3, 2016 at 0:0

4

Solved

I am using tomcat v7 with Weld v2.2.9.Final and myFaces v2.2.7 after restart server in eclipse IDE and reload page I getting this error. I have no clue why this error appear to me. It has to be con...
Censorious asked 25/2, 2015 at 7:47

2

Solved

With Spring and Micronaut, there are very concise ways to inject a different bean depending on what environment/profile an application is running in. I'm trying to do the same with Quarkus. I've ...
Algernon asked 15/2, 2020 at 16:31

6

Solved

Is it possible to use CDI to inject parameters into method calls? The expected behaviour would be similar to field injection. The preferred producer is looked up and the product is used. What I w...
Starter asked 23/5, 2012 at 10:32

2

Solved

I don't have a clustered environment at present, but I was curious about @ApplicationScoped behaviour in a clustered environment. Is there going to be only one across the cluster or is still still ...
Rives asked 18/8, 2015 at 2:15

0

I have a web application currently deployed on Wildfly 22, using JSF 2.3 and OpenJDK 11. I'm currently migrating the login page from j_security_check to a programmatically login, following BalusC e...
Booby asked 22/1, 2021 at 17:20

© 2022 - 2025 — McMap. All rights reserved.