cdi

WELD-001519 An InjectionTarget implementation is created for an abstract class 'xxx'. It will not be possible to produce instances of this type

只谈情不闲聊 提交于 2019-12-19 19:53:10
问题 I'm running an application in the following environment. GlassFish Server 4.0 Mojarra 2.2.4 PrimeFaces 4.0 final PrimeFaces Extension 1.1.0 OmniFaces 1.6.3 After adding OmniFaces, the following warnings appear on the server terminal. WARNING: WELD-001519 An InjectionTarget implementation is created for an abstract class org.omnifaces.eventlistener.DefaultServletContextListener. It will not be possible to produce instances of this type! WARNING: WELD-001519 An InjectionTarget implementation is

@Inject not working in AttributeConverter

我与影子孤独终老i 提交于 2019-12-19 19:48:25
问题 I have a simple AttributeConverter implementation in which I try to inject an object which have to provide the conversion logic, but @Inject seem not to work for this case. The converter class looks like this: @Converter(autoApply=false) public class String2ByteArrayConverter implements AttributeConverter<String, byte[]> { @Inject private Crypto crypto; @Override public byte[] convertToDatabaseColumn(String usrReadable) { return crypto.pg_encrypt(usrReadable); } @Override public String

Can CDI inject standard library POJOs into an EJB?

柔情痞子 提交于 2019-12-19 17:46:02
问题 I can inject my own POJO into a managed object like this: import javax.ejb.Stateless; import javax.inject.Inject; @Stateless public class SomeEjb { @Inject private SomePojo somePojo; } And I have this POJO: // No annotations public class SomePojo { } This works fine. If I inject the EJB into a JSF backing-bean, I can see that the value of somePojo is non-null value, as expected. However, if I try to inject a java.util.Date into SomeEjb , I get the following exception on deployment: Severe:

Constructor injection vs Field injection

好久不见. 提交于 2019-12-19 15:14:10
问题 When injecting any services, I have two choices : (Field injection) @Inject private MyService myService; or ( Constructor injection ) private MyService myService; @Inject public ClassWhereIWantToInject(MyService mySerivce){ this.myService = myService; } Why Constructor injection is better than Filed injection ? 回答1: Do something like (I assume you are using spring-boot or something comparable for your CDI) public class ClassWhereIWantToInject{ private MyService myService; @Inject public

<h:commandButton> does not initiate a postback

百般思念 提交于 2019-12-19 10:27:39
问题 I am using JSF 2.1.7 and Myfaces CODI 1.0.5 on JBoss AS 7.1.1. My <h:commandButton> is not working. I have read the requirements and have through examples in many blogs all to no avail. My facelets code is as follows <ui:define name="pagecontent"> <h1 class="title ui-widget-header ui-corner-all">Upload Bulk Contact File</h1> <div class="entry"> <h:form enctype="multipart/form-data" id="upload"> <p:panel closable="false" collapsed="false" header="Excel Contact Uploader" id="pnlupload" rendered

CDI call interceptor annotated method within same instance

梦想的初衷 提交于 2019-12-19 09:39:24
问题 here is my DAO implementation, i will load the whole table and cached in memory for a certain period of time @ApplicationScoped public class DataAccessFacade { @Inject private EntityManager em; @CacheOutput public Map<String, String> loadAllTranslation() { List<Translation> list = em.createQuery("select t from Translation t").getResultList(); Map<String, String> result = new HashMap<String, String>(); // do more processing here, omitted for clarity return result; } public String

@SessionScoped CDI bean is a different Instance when injected

吃可爱长大的小学妹 提交于 2019-12-19 09:05:25
问题 My config is a bean that I inject in my code wherever I need it. However, when injected, I get a new instance of the bean instead of the one from the session. My bean: @Named @SessionScoped public class TestModel implements Serializable { private static final long serialVersionUID = 4873651498076344849L; private String version; public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public void changeVersion() { this.version = "Version

How to instantiate more CDI beans for one class?

时光总嘲笑我的痴心妄想 提交于 2019-12-19 08:12:36
问题 Note : The similar question has been already asked three years ago, in time of EE 6, see how to instantiate more then one CDI/Weld bean for one class? Has something changed in EE 7 ? In Spring there is possible to instantiate any class by defining the corresponding bean in xml conf. It is also possible to instantiate more beans for one class with different parameters..... Is it possible to do it in CDI, I mean to create an instance without creating another class? Spring Example: <bean id="foo

How to instantiate more CDI beans for one class?

穿精又带淫゛_ 提交于 2019-12-19 08:12:32
问题 Note : The similar question has been already asked three years ago, in time of EE 6, see how to instantiate more then one CDI/Weld bean for one class? Has something changed in EE 7 ? In Spring there is possible to instantiate any class by defining the corresponding bean in xml conf. It is also possible to instantiate more beans for one class with different parameters..... Is it possible to do it in CDI, I mean to create an instance without creating another class? Spring Example: <bean id="foo

how to instantiate more then one CDI/Weld bean for one class?

佐手、 提交于 2019-12-19 06:46:20
问题 In Spring it was possible to instantiate any class by defining the corresponding bean in xml conf. It was also possible to instantiate more then one bean for the same class with different parameters..... Are the such features in CDI as well, namely is it possible to create different instances of the same class with different initialization parameters? Is it also possible to create a bean without changing the class....I mean without adding annotation? ADDED Let me make an example. <bean id=