Meaning of bean discovery mode annotated in CDI 1.1

When using bean-discovery-mode=”annotated” only classes with a bean defining annotation are discovered. All other classes are ignored. Any scope type is a bean defining annotation. If a scope type is declared on a bean class, then the bean class is said to have a bean defining annotation [spec]. The 1.1 spec is not completely clear … Read more

Difference between javax.inject.Singleton and javax.ejb.Singleton

I found a plausible explanation here: By default, javax.ejb.Singleton session beans are transactional (section 13.3.7 of the EJB 3.1 specification) and require acquisition of an exclusive lock for every business method invocation (sections 4.8.5.4 and 4.8.5.5). In contrast, a javax.inject.Singleton is not transactional and does not support container-managed concurrency (the major consequence being that no … Read more

Spring vs Java EE 7 [closed]

I will share little bit of what I know about using Spring. You are right by saying that Java EE 7 has all the technologies to help solve the problems. Well Spring just enhances these capabilities and makes life more easier for a developer. As an example when you use Spring MVC framework you can … Read more

Accessing HttpSession from HttpServletRequest in a Web Socket @ServerEndpoint

Update (November 2016): The information provided in this answer is for the JSR356 spec, individual implementations of the spec may vary outside of this information. Other suggestions found in comments and other answers are all implementation specific behaviors outside of the JSR356 spec. If the suggestions in here are causing you problems, upgrade your various … Read more

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

@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 … Read more

How to get a method’s annotation value from a ProceedingJoinPoint?

You can get the Signature from a ProceedingJoinPoint and in case of a method invocation just cast it to a MethodSignature. @Around(“execution(public * *(..)) && @annotation(com.mycompany.MyAnnotation)”) public Object procede(ProceedingJoinPoint call) throws Throwable { MethodSignature signature = (MethodSignature) call.getSignature(); Method method = signature.getMethod(); MyAnnotation myAnnotation = method.getAnnotation(MyAnnotation.class); } But you should first add an annotation attribute. … Read more

What is WEB-INF used for in a Java EE web application?

The Servlet 2.4 specification says this about WEB-INF (page 70): A special directory exists within the application hierarchy named WEB-INF. This directory contains all things related to the application that aren’t in the document root of the application. The WEB-INF node is not part of the public document tree of the application. No file contained … Read more

tech