In my JEE6-CDI-webapp, i declared a Security Interceptor, like this one:
//Secure.java
@Inherited
@Target({TYPE, METHOD})
@Retention(RUNTIME)
@InterceptorBinding
public @interface Secure
{}
//SecurityInterceptor.java
@Secure
@Interceptor
public class SecurityInterceptor
{
@AroundInvoke
protected Object invoke(InvocationContext ...
i have a producer, i want to put it in a jar, so that my diff war files can refer the same implementation
public class LogFactory {
@Produces
public Logger createLogger(InjectionPoint injectionPoint) {
return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
}
}
but it turns now, glassfish (3.0.1) ...
@Path(value = "/user")
@Stateless
public class UserService {
@Inject
private UserManager manager;
@Path(value = "/create")
@GET
@Produces(value = MediaType.TEXT_PLAIN)
public String doCreate(@QueryParam(value = "name") String name) {
manager.createUser(name);
return "OK";
}
}
here is the u...
Hi, guys i'm new and i'm not english.
I have a problem with using js setInterval that simulate a user click, every X seconds, on submit button.
In the page there is only one h:form and h:commandButton.
I use a profiler and i see that the java.util.HashMap increase continuosly it's size.
After some hours the used heap size is growed a lot...
Hi all,
I would like to have my own contexts for some CDI-based projects. I need (want) custom scopes so that I can isolate the how long a component lives and where.
To implement your own context, you need to implement the Context interface which is pretty self-explanatory, but how or where to you really define when it is created?
Th...
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 Trans...
Hi there
After 2 days of debugging and trying I have no other idea than asking you for a solution.
I want to use CDI (on JEE6) in a Tomcat WebApp with only simple plain old java objects (yet).
As far as I know it is simply possible to inject POJO java classes into other POJO Java classes?!
Here are my example classes
class ToBeInjec...
Hi,
I'm trying to use CDI for my JSF/Java EE application. I have the following class hierarchy:
/**
* base controller class
* also contains some final methods and an inner enum class declaration
*/
public abstract class AbstractCrudController<K, E> implements Serializable {
private Class<E> entityClass;
public AbstractCrudCont...
Hi all,
I am using CDI and want to know how the caller is notified that the observer has observed an event or didn't. If no observes act on that event, then I want to do something. I don't see this being documented anywhere in the documentation other than there was a hint that the caller is notified.
Thanks,
Walter
...
I am new to weld and consider what environment is useful for a web-application using CDI (Weld). I want to use JSF or Wicket for presentation and JPA/Hibernate for my persistence layer (including Transaction-Management). The obvious scenario is to use a JBoss or Glassfish application server with EJB3 surrounding, but is there not a chanc...
I have a MySQL database with many databases, each named for a specific customer.
A webapp is deployed per customer. The name of the webapp determines the underlying database name. When the webapp starts up, I have a modified Spring PropertyPlaceholderConfigurer to grab the ServletContext if it can and determine the name. I then derefere...
Hi all,
I was wondering if there is already a book available, more or less dedicated to CDI (Contexts and dependency injection - JSR299).
Dependency Injection by Dhanji Prasanna is a good book, but it more focussed on JSR330 and Spring DI.
Thank you,
J.
...
Let's say I have an interface called SocialNetworkService, and three implementations - TwitterService, FacebookService and FriendFeedService.
Now I want, whenever my managed bean (or whatever web component) receives a message, to share it in all social networks. I tried:
@Inject private List<SocialNetworkService> socialNetworkServices;...
I'm not a fan of JSF. Spring MVC makes a lot of sense to me and I've used it in the past.
Can you talk me out of it or provide tips for integrating it nicely into JEE6 and share and gotchas with CDI.
I don't mind having an application context just for the MVC stuff but if I use @Inject or @EJB in my MVC controllers, what's going to go ...
I'm running a Java EE 6 application out of an EAR (bundling an EJB-JAR and a WAR) on GlassFish 3.0.1, using ICEfaces 2.0 Beta 1 and a Seam Faces 3.0.0 Alpha 3 Snapshot.
When I deploy the EAR, I get an error. This error doesn't happen when I remove Seam Faces. Here's the error from my GlassFish log (I redacted the first bit, where it jus...
My Java EE 6 application consists of a war and an ejb module packaged in ear file. I'm using CDI for DI (i.e. I have a beans.xml file in both modules). I want to use a logging interceptor that is defined in the ejb module in the war module, as well. I've enabled the interceptor in the ejb's beans.xml:
<beans>
<interceptors>
...