cdi

Use @EJB as injection annotation in Weld

被刻印的时光 ゝ 提交于 2019-12-11 05:32:20
问题 I have an application which is part JavaEE (the server side) part JavaSE (the client side). As I want that client to be well architectured, I use Weld in it to inject various components. Some of these components should be server-side @EJB. What I plan to do is to extend Weld architecture to provide the "component" allowing Weld to perform JNDI lookup to load instances of EJBs when client tries to reference them. But how do I do that ? In other worrds, I want to have on the client side public

Is Shiro Native Session Management Compatible With JSF SessionScoped CDI Beans

南笙酒味 提交于 2019-12-11 05:04:03
问题 Am having a problem with Shiro native session management and JSF CDI SessionScoped beans. Am using Shiro 1.4.0 and Payara 4.1.1.171 (build 137). This is kind of a complicated interaction, so I have created a very simple scenario to demonstrate the problem (see code below). Here is what is happening: When I use Shiro's default (non-native) session management, I can log in to the test application and press the "Say Something New" button (which is using AJAX) and my screen will be properly

Weld CDI on Google App Engine: Injection in servlet not happening

自闭症网瘾萝莉.ら 提交于 2019-12-11 04:00:05
问题 This is my first time working with GAE and I'm trying to get CDI working. Long story short: The @Inject field in my servlet is not getting injected (it's always null ). I'm working in Eclipse and debug the application on the local test server included in the GAE SDK (which is started by Eclipse as well). When I access the servlet on localhost , I get a null-pointer exception for someService . I've also output the value of someService to verify it is really null , which it is. Edit: When I

How to programmatically lookup and inject a CDI managed bean where the qualifier contains the name of a class

血红的双手。 提交于 2019-12-11 03:59:25
问题 I am trying to programmatically lookup and inject a CDI managed bean where the qualifier contains the name of a class (not the class I want to inject), however the problem I've got is that the code I'm using to lookup the correct bean always returns with null . The beans I want to inject are annotated with a custom annotation called @CQRSCommandHandler which contains the name of a class being used as a qualifier and the beans also implement an interface called CommandHandler . The classes I'm

Disable scanning of CDI beans in WAR

一世执手 提交于 2019-12-11 03:36:20
问题 I have WAR package with CDI beans. Deployment of the package is very slow because every time during deployment the package is scanned for CDI beans. Is there any option to disable this process? 回答1: The correct way is to disable discovery in the beans.xml of the relevant archive: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp

Using CDI in Quartz Jobs

 ̄綄美尐妖づ 提交于 2019-12-11 03:16:06
问题 I would like to know if it is possible to use CDI beans in Quartz jobs in a portable way? I have already tried to write my own JobFactory and so on, but the problem is, that the BeanManager is not available through JNDI, because the job runs in a non managed thread. My application server is Websphere 8.0.0.1 and I already read that it is against the EE6 spec to make the name "java:" available to non managed threads. There are two solutions now I think: Let Websphere create the worker threads

Omnifaces 2.x fails when used in a Spring Boot environment with Weld

筅森魡賤 提交于 2019-12-11 03:14:30
问题 Finally I successfully bootstrapped Weld in a Spring Boot environment as explained here. CDI works with no problem both for JSF using Mojarra and for Web Services using Jersey. But now I encountered a problem when trying to include Omnifaces 2.6 in my application. My application start fails with this message: com.sun.faces.config.ConfigurationException: Factory 'javax.faces.lifecycle.ClientWindowFactory' was not configured properly. at com.sun.faces.config.processor.FactoryConfigProcessor

Why are Producers not inherited in CDI

痞子三分冷 提交于 2019-12-11 01:32:17
问题 Given the following classes private static class ProducedInSubClass { } private static class ProducedInSuperClass { } public static class SuperClass { @Produces public ProducedInSuperClass producedInSuperClass = new ProducedInSuperClass(); } public static class SubClass extends SuperClass { @Produces ProducedInSubClass producedInSubClass = new ProducedInSubClass(); } public static class BeanWithSubClass { @Inject SubClass subClass; @Inject ProducedInSuperClass producedInSuperClass; @Inject

OpenWebBeans CDI failing in Java 11

岁酱吖の 提交于 2019-12-11 01:27:41
问题 My application is using Java 11, Tomcat 9.0.13 and OpenWeBeans CDI 2.0.8. While starting my Tomcat server I get the following error: Dec 19, 2018 9:59:04 AM org.apache.webbeans.servlet.WebBeansConfigurationListener contextInitialized SEVERE: An error occurred while starting application context path : [/abcServer] Dec 19, 2018 9:59:04 AM org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context initialized event to listener instance of class org.apache.webbeans

JPA CDI Injecting DAO into an Entity

我的梦境 提交于 2019-12-11 01:04:36
问题 I'm new to JPA and CDI and I'm trying to create an enterprise application using these frameworks. I get how I can inject into beans and keep everything tidy and stateless. I also get that JPA loads relations etc. for me so that I don't have to worry about it anymore. I still use my DAO's for specific find methods and ofcourse to create new entities. I understand that I don't want to be injecting stuff into my entities since they're managed by JPA and I need to use the new keyword to create a