java-ee-7

injectionPoint.getBean() returns null if bean is an EJB bean in Java EE 7 (CDI 1.1)

三世轮回 提交于 2019-12-21 02:35:20
问题 I want to get bean from producer method in order to read its properties. In some scenarios the bean is a EJB Singleton bean. I've simplified my code to focus on the problem. My simple qualifier: @Qualifier @Retention(RUNTIME) @Target({TYPE, METHOD, FIELD, PARAMETER}) public @interface InjectMe {} Simple producer: @Dependent public class SimpleProducer { @Produces @InjectMe public String getInjectMe(InjectionPoint ip) { // ip.getBean() returns null for some reason return "ip=" + ip + ", bean="

FacesServlet URL Patterns

隐身守侯 提交于 2019-12-20 03:06:56
问题 I am not sure what I am doing wrong here but when I put the faces context twice in the URL it bypasses all of my Realm Securities. My URL Pattern: <servlet-mapping> <servlet-name>Faces</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> Security Constraint <security-constraint> <display-name>ADMIN</display-name> <web-resource-collection> <web-resource-name>Protected Admin Area</web-resource-name> <description/> <url-pattern>/faces/admin/*</url-pattern> </web-resource

Simple ways to keep data on redeployment of Java EE 7 web application

主宰稳场 提交于 2019-12-20 03:02:52
问题 My Java EE 7 web service generates statistics once per day, and because data is stored only in an ApplicationScoped bean, it does not survive redeployment, so clients cannot retrieve statistics until the next run completed. Does Java EE 7 provide a simple way to keep application state so that it will be available after redeployment, similar to an in-memory database? As it is only one big object (list), I would prefer something simpler (and maybe better performing too) than a database. 回答1: In

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 implement push to client using Java EE 7 WebSockets?

 ̄綄美尐妖づ 提交于 2019-12-18 13:09:27
问题 I've browsed a lot of Web Socket examples, presentation slides and they are mostly concentrated on a rather simple scenarios in which client-server communication is initiated by the client. I am interested in another scenario, which seems to be equally practical: pure server push to client. Example I have in mind is an application that updates stocks value on a website. Imagine there is an external system stock exchange system, which is sending a JMS message for every subscribed stock value

Custom bean validation does not `@inject` CDI beans and does not interpolate message?

做~自己de王妃 提交于 2019-12-18 07:24:41
问题 I am using GF4 with bean validation. I am trying to @Inject a service bean in my custom validator but I get a null value. public class TestValidator implements ConstraintValidator<>{ @Inject Service myService; } Isn't this suppose to be working with JEE7? Also, I am trying to find built-in dynamic message interpolation (Without writing my own MessageInterpolator ). I did see some examples but they are not very clear. What I am looking for is to pass dynamic parameters from the

What is the significance of @javax.persistence.Lob annotation in JPA?

本秂侑毒 提交于 2019-12-17 18:27:51
问题 When should I use @javax.persistence.Lob annotation in JPA? What datatypes can be annotated by this annotation? 回答1: @javax.persistence.Lob signifies that the annotated field should be represented as BLOB (binary data) in the DataBase. You can annotate any Serializable data type with this annotation. In JPA, upon persisting (retrieval) the field content will be serialized (deserialized) using standard Java serialization. Common use of @Lob is to annotate a HashMap field inside your Entity to

javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL does not work anymore since Java EE 7 / EL 3.0

偶尔善良 提交于 2019-12-17 07:37:52
问题 <context-param> <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name> <param-value>true</param-value> </context-param> Does not work with the latest Mojarra 2.2.5 on both glassfish 4 and wildfly 8 Final I have seen multiple bug reports on this, Manfried Riem says, It was determined this is an EL issue and the EL implementation has been fixed to fix this The fix versions says 2.2.5, and it is also stated in the release notes of 2.2.5, am I missing something? 回答1:

Meaning of bean discovery mode annotated in CDI 1.1

拟墨画扇 提交于 2019-12-17 07:30:46
问题 I am migrating an application to Java EE 7 and would like to CDI 1.1. But I don't get the meaning of bean-discovery-mode="annotated" . The CDI 1.1 specification is not very helpful. At least I have not found any useful paragraph. Did I miss it? This example runs perfectly with bean-discovery-mode="all" and injects an instance of LoggingClass : public class LoggingClass { public Logger logger = Logger.getLogger("ALOGGER"); } @Test public class MMLoggerProducerIT extends Arquillian { @Inject