Questions tagged as 'cdi'

2
answers

___ ___ erkimt With the departure of ViewScoped the new specification of the JSF, which scope to use now in my managed beans that used using JSF 2.2? ______ qstntxt ___

I have a big question now with the appearance of JSF 2.2: What do I do with my views and my old managed beans? How do I now (what scope to use) since I can not use more view scoped in a view that needs to keep some objects in memory between ajax requests?

    
______ azszpr95 ___

According to: link

La says that the @ViewScoped annotation in the javax.faces.bean.ViewScoped package should become deprecated, given the creation of the @ViewScoped annotation of the javax.faces.view.ViewScoped package.

This happens, considering the adoption of an extension of the CDI, using the second annotation. If you do not use the CDI, this annotation will not work.

    
______ azszpr96 ___

You can and should use the CDI ViewScoped: javax.faces.view.ViewScoped, however of course, you need to use CDI beans.

What happens is that JSF ViewScoped does not work with CDI beans, and JSF is taking the course where CDI beans will override JSF Managed Beans. So they are making arrangements for the entire javax.faces.bean package to become deprecated in the future.

More information here at this link: link

    
___

I have a big question now with the appearance of JSF 2.2: What do I do with my views and my old managed beans? How do I now (what scope to use) since I can not use more view scoped in a view that needs to keep some objects in memory between ajax...
asked by 11.12.2013 / 19:18
2
answers

JAX-RS Resource as Session Bean or CDI Managed Bean?

Today I ran into an interesting problem when trying to inject an EJB into a JAX-RS resource (in GlassFish 4.1, running the preinstalled version of Jersey). @Stateless public class MeuEJB implements MinhaInterface { // código } @Path("camin...
asked by 26.09.2014 / 23:09
1
answer

CDI @Inject Named bean in another Named bean

I'm using jsf 2.2. I have 2 @Named beans in @ViewScoped @Named(value = "menuMB") @ViewScoped public class MenuMB implements Serializable{ } @Named(value = "produtoGeralMB") @ViewScoped public class Produt...
asked by 25.02.2014 / 14:09
1
answer

What is CDI technology?

I'm developing a web application and a colleague from the university who is some periods beyond what I'm studying said that using the CDI would have a better performance, however, so far had not heard of that term. I would like a simple example...
asked by 24.11.2015 / 01:54
2
answers

NullPointerException Java JPA CDI Tomcat

Good afternoon, guys. I'm developing a Java test application with JPA, CDI and Tomcat. I created a basic test class and I'm getting the following error. Erro: Exception in thread "main" java.lang.NullPointerException at br.com.hcancerbarre...
asked by 29.07.2016 / 21:52
1
answer

JavaSE with CDI and JPA - Error WELD-001303

I am studying JPA and CDI in a Java SE application. When I create the EntityManagerFactory I come across the error: Exception in thread "main" org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope t...
asked by 13.06.2015 / 22:58
2
answers

Scope equivalent to @Stateless in CDI

I'm migrating the EJB annotations of my application to CDI and I have some questions: What is the scope equivalent to @Stateless of EJB in CDI? Would @ResquestScoped do equivalent behavior? I have tested using @State...
asked by 11.09.2017 / 00:44
1
answer

Inject dependencies in the constructor of an EJB can cause modularization and performance problems?

I recently migrated from Spring to CDI + EJB, I tried to inject my dependencies directly into the builder just like I did in Spring and how it is supported by the CDI but in an EJB: @Stateless public class UserService { private UserDao u...
asked by 10.01.2015 / 20:55
0
answers

Problem with Weld CDI with TomCat server

Hello everyone, I'm having trouble using the CDI implementation, Weld on Tomcat 7. I've been researching and tried several proposed solutions, but all these solutions are old, with dates of 2012. None of these solutions worked. Let the setti...
asked by 09.12.2015 / 18:54
2
answers

Converter and Validator with CDI injection

Can anyone inject CDI or EJB in Converter or Validator in JSF 2.2? It was said that from 2.2 it would be possible but I'm not getting it. I've tried @EJB UserService userService and also @Inject UserService userService and both di...
asked by 30.06.2015 / 15:53