cdi

@Entity with JSF, persist “hello world” with JPA

人走茶凉 提交于 2019-12-12 01:52:28
问题 Oracle describes very well how to make an @Entity. However, it's not strictly clear to me how to actually add/drop tables. I also like the rose india explanation, but just want to clarify the general idea. For a JSF JEE6 app with CDI, I can basically just create an @Entity class, instantiate some instances in the @Named bean, and write (CRUD operations) to the MySQL database with an EntityManager from the bean? I can just use default JPA which comes with Glassfish? Just want to clarify the

CDI - Producers and Qualifiers not on the produced object

你离开我真会死。 提交于 2019-12-12 01:24:22
问题 imagine having a producer for a SessionFactory (as example): @Produces public SessionFactory produceSessionFactory(){} No I have a second producer that produces some other object, lets say a DatabaseObject, and needs a reference to a SessionFactory: @Produces public DatabaseObject produceDatabaseObject(SessionFactory factory){} No I can use my database object like that: @Inject DatabaseObject object; So far, so good. So lets assume this stuff is implemented in a framework and is going to be

(AS7) Error calling remote EJB method with proxified CDI bean in parameter

心不动则不痛 提交于 2019-12-12 00:05:22
问题 Can I call a remote EJB method with CDI bean in parameter method? Like this: I have a LoggedUserProducer.java thats produces a User from the database. public class LoggedUserProducer { @Produces @SessionScoped @LoggedUser public User produceLoggedUser() throws Exception { ... //load user from database with a request token return user; } } And I have a JSF Bean thats make the EJB call: CarController.java @Named @ViewScoped public class CarController implements Serializable { @Inject //I have a

Wildfly 14 CDI: WELD-001408 on 3rd part JAR after migration from JBoss 7

跟風遠走 提交于 2019-12-11 18:28:54
问题 We are migrating a few old systems written in Java 5, 6 and 7 to Java 8 and from JBoss 7 to Wildfly 14. After the migration, I get all the time this kind of error: WELD-001408: Unsatisfied dependencies for type InterfaceTypeConverterProvider with qualifiers @Named I understand that from CDI 1.2 things changed and the @Inject don't work as it used to be and it need some refactoring. I got many errors like this, some of them are classes in my own project that try to Inject other classes also

Custom qualifiers on interface doesn't work on injection

偶尔善良 提交于 2019-12-11 18:21:53
问题 The Problem: Hello i'm having a problem on java EE , i have to use annotation like @Inject @Stateless etcetc, but i can't get a solution, after reading a lot of documentation and example etcetc it seems that what i 've code should work but definitly not. So the problem is that i have a custom qualifiers on an interface like this @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface BudgetsDs { } and i want inject it in another object as a member field like

Unsatisfied dependencies for type ResourceBundle with qualifiers @Bundle

余生长醉 提交于 2019-12-11 17:52:35
问题 Based on the proposed solution here, I am trying to use CDI @Produces to be able to access with @Inject multiple properties files: Bundle Interface package com.locale; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.enterprise.util.Nonbinding; import javax.inject.Qualifier; @Qualifier @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType

WELD-001409: Ambiguous dependencies for type StepContext with qualifiers @Default

橙三吉。 提交于 2019-12-11 17:30:02
问题 I am trying to run this example in java SE mode from my windows command prompt. I have built a jar with all dependencies included in it and running it from my command prompt. but, keep getting this error. From this answer, i understand that there could be multiple StepContext classes in my runtime classpath. i now replaced the maven-assembly plugin with the maven-shade plugin to build my fat jar and i can see the following warning while packaging the jar [WARNING] javax.inject-1.jar, weld-se

How do I load spring-data(-neo4j)-repositories lazily?

拟墨画扇 提交于 2019-12-11 16:26:20
问题 I am using spring-data-neo4j (standalone) in my JavaEE7-application as nice neo4j-OGM. For time being, I am trying to integrate spring-data-neo4j repositories via @Autowired into my project. public interface UserRepository extends GraphRepository<User> {} I have started writing some JUnit-tests, which are testing beans which themselves use this repositories. Everything works fine so far. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/spring/application-context

Injection in a converter does not work in JSF 2.3

为君一笑 提交于 2019-12-11 16:03:53
问题 Server: Payara 5.183. When the converter is used, a NullPointerException is raised because the injected EJB is null (System.out.println prints "null"). It works (injection not null) if I use a workaround used before JSF 2.3: replacement of @FacesConverter by @Name. Converter: @FacesConverter(value = "compteConverter", managed = true) public class CompteConverter implements Converter<CompteBancaire> { @EJB private GestionnaireCompte gestionnaireCompte; @Override public CompteBancaire

CDI session bean initialization

▼魔方 西西 提交于 2019-12-11 15:49:49
问题 I have two beans: @Named @SessionScoped public class Session implements Serializable { private String temp; +getter, setter } @Named @RequestScoped public class Test { @Inject private Session s; @PostConstruct public void init() { this.sth = s.getTemp(); //here is exception } } When I try to fetch in init same value from session I get NullPointerException. What am I doing wrong? Server is JBoss eap 6.0, JSF v2.1. Thanks in advance Edit: I investigated that problem appears only when I have