jboss-weld

CDI - Observing Container Events

六眼飞鱼酱① 提交于 2019-12-04 05:57:09
I am trying to observe both the startup and shutdown events for a CDI web application. I have an ApplicationScoped bean that listens for those events: @ApplicationScoped public class PrettyfacesStartupObserver { private static final Log LOGGER = LogFactory.getLog(PrettyfacesStartupObserver.class); public PrettyfacesStartupObserver() { LOGGER.debug("\n\n\n\n\n\n\n\n\n\nconstructor"); } public void onStartup(@Observes AfterBeanDiscovery afterBeanDiscovery ) { LOGGER.debug("\n\n\n\n\n\n\n\n\n\nafter bean discover"); } public void onStartup(@Observes AfterDeploymentValidation

“Unable to convert ejbRef for ejb” on CDI (Weld) injection of @Stateless EJB into @SessionScoped JSF2 bean in Glassfish

怎甘沉沦 提交于 2019-12-04 05:19:16
[ UPDATE : After discussion on the Glassfish forums/ML at http://forums.java.net/jive/thread.jspa?messageID=480532 a bug was filed against Glassfish https://glassfish.dev.java.net/issues/show_bug.cgi?id=13040 for this issue.] I'm trying to inject a local no-interface view of a @Stateless EJB into a JSF2 @Named @javax.enterprise.context.SessionScoped backing bean. The EJB is one of several that extend an abstract generic base class. Injection of "@Inject TheEJBClass varName" fails with "Unable to convert ejbRef for ejb TheEJBClass to a business object of type class my.package.name

Can CDI be lessened towards Java SE?

帅比萌擦擦* 提交于 2019-12-04 04:39:07
JSR-330 dependency injection can be applied to both Java SE and Java EE environments, while JSR-299 is titled "Contexts and Dependency Injection for the Java EE platform". Except strictly Java EE-oriented features, what CDI features make sense on Java SE as well? Any examples available? Thanks! [Revised] Here's Weld on JSE. Pascal Thivent Except strictly Java EE-oriented features, what CDI features make sense on Java SE as well? Any examples available? Thanks! Well, the one mentioned in the Weld documentation: 18.4. Java SE In addition to improved integration of the Enterprise Java stack, the

Richfaces 4 a4j:commandLink action not firing in rich:popupPanel

最后都变了- 提交于 2019-12-03 17:00:20
I seem to be having a problem where I have an a4j:commandLink on a rich:popupPanel but the action is not firing. The xhtml looks as follows: <rich:popupPanel id="rate-panel" modal="true" height="444" width="780" top="60" show="false" onmaskclick="#{rich:component('rate-panel')}.hide()" styleClass="cs-modal"> /**Some html here**/ <a4j:commandLink immediate="false" action="#{venueScore.up}" render="rate-panel" styleClass="rate love"> <span>Love it</span> </a4j:commandLink> /**Some more html here**/ </rich:popupPanel> And the managed bean looks as follows: @Named("venueScore") @ViewScoped public

JSF2 managed bean annotation + scope + injection confusion

允我心安 提交于 2019-12-03 16:06:25
I would like to achieve this idealism : To have only 1 implementation for the JSF Bean container, like to use only Spring or Weld but not both. Currently i am using Spring for my backend, so i prefer Spring. To have only 1 annotation, to choose between @ManagedBean, @Named, @Model To be able to use all supported scopes, like @RequestScoped, @SessionScoped, @ViewScoped, @FlashScoped, maybe also @ConversationScoped The JSF Beans could be injected with spring-managed-services (The backend services), perhaps using @Inject or @Autowired So far i've been finding no best combination to achieve these

CDI/Weld: book or resource recommendation [closed]

断了今生、忘了曾经 提交于 2019-12-03 12:37:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Is there an existing, or upcoming book on CDI/Weld that you can recommend? I'm looking for something that's similar in scope and quality to Seam in Action, which was a great reference for Seam, but now seems a little dated. 回答1: At the time of writing I can confirm that there is nothing like this (though badly

What is Weld, JSR-299?

半腔热情 提交于 2019-12-03 09:27:23
I've found lots of tutorials showing Weld code samples, but not an introductory overview. Could you please suggest an introductory article, or answer the following: What does Weld do/give you? How does it relate to Java EE 6? How would one use it in a Java EE 6 project? If one uses it in a Java EE 6 project, what is it supplanting, if anything? BalusC What does Weld do/give you? Weld is the reference implementation of the abstract JSR-299 API , which is better known as CDI, Contexts and Dependency Injection, an API which is provided through javax.enterprise.context and javax.enterprise.inject

Is there a way to know if a state is active without catching ContextNotActiveException?

北慕城南 提交于 2019-12-03 07:57:18
I would like to know if the RequestScoped context is currently active in a method or not. At the moment, here is what I do : @Inject private BeanManager beanManager; public boolean isRequestScopeActive() { try { if (beanManager.getContext(RequestScoped.class).isActive()) { return true; } else { return false; } } catch (final ContextNotActiveException e) { return false; } } I think it's a bit heavy to catch a ContextNotActiveException just to know if a scope is active or not. Do you have any better way to know the state (active or not) of a context in CDI ? Yeah, the only option we have in CDI

jsf viewparam lost after validation error [duplicate]

半世苍凉 提交于 2019-12-03 03:08:47
This question already has answers here : Retaining GET request query string parameters on JSF form submit (2 answers) I'm facing the following issue: in one page, I list all users of my application and have an "edit" button for each one, which is a "GET" link with ?id=<userid> . The edit page has a <f:viewParam name="id" value="#{editUserBean.id}"/> in metadata. If I made some input mistakes and submit (I use CDI Weld Bean validation), the page is displayed again, but I've lost the ?id=... in the URL and so lose the user id of the user I'm editing. I've looked at a similar problem described in

Inject list of objects in CDI (Weld)

霸气de小男生 提交于 2019-12-03 01:19:56
问题 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; But it didn't work (deployment error). (Also tried to the @Any qualifier - same result) So, is there a way to inject a list of all (or some) implementations