cdi

Bean property becomes null when using CDI @Named Annotation [duplicate]

风流意气都作罢 提交于 2019-12-11 15:32:48
问题 This question already has an answer here : JSF does not populate @Named @RequestScoped bean with submitted input values (1 answer) Closed 2 years ago . I am using JSF2+CDI in a Tomcat 7 Container. I found a strange problem, I have got one @RequestScoped managed bean annotated with @Named annotation, Iam using its properties on a Facelet page. In that page three consecutive dropdown list is arranged. when the page loads i have initialized the first dropdown list using its getter method. In

“Unsatisfied Dependencies” - Different Stateless Beans with same Interface

蹲街弑〆低调 提交于 2019-12-11 15:25:26
问题 I have three @Stateless Beans with the same interface. public interface ReportService { List<String> determineRelevantData(); Report generate(ReportRequest request, Locale locale) throws ServiceFailedException; } I inject the beans in one facade bean: @Stateless public class ReportServiceFacadeBean implements ReportServiceFacadeLocal { @Inject private FirstReportBean firstReport; @Inject private SecondReportBean secondReport; @Inject private ThirdReportBean thirdReport; [...] } When I deploy

Example for CDI-SessionScoped LogIn with TomEE

拈花ヽ惹草 提交于 2019-12-11 14:06:48
问题 i'm currently fighting with TomEE, JSF and CDI (i think). Is there any example out there which has "@javax.enterprise.context.SessionScoped" annotation using TomEE 1.5.1 (or current snapshot)? I DONT want to use @ManagedBean or something else from javax.faces, just plain CDI. My problem is: when i change some @SessionScoped user session instance i end up in having a new sessionID (session fixation problem?!?). My Use-Case: I want to have a login on one page and have the possability to login

CDI: Injecting resources to beans from external libraries

て烟熏妆下的殇ゞ 提交于 2019-12-11 12:09:20
问题 In Spring we have annotation-based and XML-based configuration. While the first is recommended for quick development, the second is more flexible and able to handle special cases. By us there are currently 2: injecting mocks for JUnit tests and configuring beans from external libraries. I haven't found any equivalent for XML configuration for CDI, so my question is, how to handle dependency injection for such beans? They are from external libraries, they need to be configured and there's no

JAX-WS and CDI not working together on WAS Liberty Profile 8.5.5.6

拜拜、爱过 提交于 2019-12-11 12:03:14
问题 I am experiencing strange behavior when I attempt to combine a JAX-WS web service endpoint class and a simple CDI injection. When I try to inject the object into the WebService implementation class, the injected object's PostConstruct method is never called. Indeed the classes constructor is not called either. Here is my JAX-WS implementation class and the injection point: @WebService(serviceName="eNC3BusinessWebService") public class eNC3BusinessWebServiceImpl { @WebMethod public

Cannot perform CDI in Glassfish 4.0

坚强是说给别人听的谎言 提交于 2019-12-11 11:59:05
问题 I am trying to run a particularly simple test case using the latest promoted build of Glassfish 4.0. I have tried placing META-INF/beans.xml in all possible permutations including its own jar in WEB-INF/lib The best I get is the following errors with a layout+sources that are listed after it: WARNING: Error while trying to load Bean Class WEB-INF.classes.com.example.cdibug.Test : java.lang.ClassNotFoundException: WEB-INF.classes.com.example.cdibug.Test WARNING: Error while trying to load Bean

Passing state to CDI-container-managed beans

感情迁移 提交于 2019-12-11 11:38:53
问题 I'm using Spring for this project, but I've had the same problem with Guice as well. Basically, I have functionality that requires both stateless helpers and state data to operate on. public class AwesomeDoer { @Inject private Helper helper; //stateless ... public void doAwesome(int state) { helper.help(state) } } This looks pretty good, until doAwesome has 5 parameters and is being called 1000 times, but 3 of the arguments are the same value every time while a fourth argument might change

Passing parameter while injecting and retrieving using InjectionPoint

对着背影说爱祢 提交于 2019-12-11 11:38:28
问题 This is relevant to one asked in Pass Parameter to Instance of @Inject Bean but i need some different approach for my implemenation. For passing parameter while injecting, a custom qualifier can be created like : @Qualifier @Target({ TYPE, METHOD, PARAMETER, FIELD }) @Retention(RUNTIME) @Documented public @interface SendInject{ @Nonbinding int value() default 0; // int value will be store here } The class to be injected need to be annotated with @SendInject as: @SendInject public class

How to retrieve all existing long-running conversations in Weld?

我的未来我决定 提交于 2019-12-11 11:26:03
问题 I'm writing application in JBoss 7.1.1.Final, Weld, Seam 3. I have following bean: @ConversationScoped public class ConversationBean implements Serializable { @Inject Conversation conversation; private Article article; ... } Now, the user might create multiple conversations, each conversation will be associated with the instance of ConversationBean. I need to be able to get all those instances that are associated with long-running conversation. The reason why I need an access to them is that

Do I need getter for the injected Conversation interface in CDI bean?

萝らか妹 提交于 2019-12-11 10:45:37
问题 I have a @ConversationScoped CDI bean with a Conversation interface injected and access modifier set as private. Something like this: @Named @ConversationScoped public class MySampleCdiBean implements Serializable { @Inject private Conversation conversation; //other stuffs } My question is do I need a getter for this injected conversation interface? Does the CDI container need this getter? Any resource from where I can understand the underlying details of how CDI container handles a