Questions tagged [weld]

Weld is the reference implementation (RI) for JSR-299: Java Contexts and Dependency Injection for the Java EE platform (CDI)

Weld is the reference implementation (RI) for JSR-299: Java Contexts and Dependency Injection for the Java EE platform (CDI)

See http://seamframework.org/Weld

592 questions
4
votes
1 answer

Is there a way to re-inject / update injected bean fields?

I have some beans (of multiple types, CDI, @Stateless and @Singleton beans). Some of their fields shall get injected from database values. public class MyBean { @Inject @DbConfigValue(MyConfig.HOST) String host; } So I added a custom…
Ben
  • 150
  • 4
  • 14
4
votes
1 answer

After migration from JSF @ManagedBean to CDI @Named, constructor called multiple times and submitted input values always null

Edit: The comment section solved my problem! The problem was that I was using incorrect imports for the Scopes. I have a simple JSF application (login, pull data from database, allow user to edit data). It works well, I want to update the code to…
Lomtrur
  • 1,703
  • 2
  • 19
  • 35
4
votes
1 answer

How to get an executable jar for a weld se application

I have a little cli application that uses weld se that works fine if i run the application from within eclipse (using the main method from weld se: org.jboss.weld.environment.se.StartMain) The problem is i can't create an executable jar that works.…
dermoritz
  • 12,519
  • 25
  • 97
  • 185
4
votes
2 answers

JAX-WS with Apache CXF under CDI/Weld

I have seen the other questions on CXF under CDI but they all seem to be for JAX-RS style web services. Is JAX-WS possible in this configuration? If not, how can I expose a JAX-WS service using CDI/Weld in a non-EE container (Tomcat 8)?
Michael Sharek
  • 5,043
  • 2
  • 30
  • 33
4
votes
1 answer

Is it possible to activate the Session Scope and Conversation Scope from the existing Request Scope?

I have an @EJB injected bean TransactionCompleteJob. This bean has an @Asynchronous method on it asyncCompleteTransaction(Integer transactionId). When I try to make use of other injected beans and entities that are either session scoped or…
Matt Fellows
  • 6,512
  • 4
  • 35
  • 57
4
votes
1 answer

How can I enable CDI with Jersey Test Framework?

I found How can I inject a data source dependency into a RESTful web service with Jersey (Test Framework)? but I think I'm gonna ask a little bit different question. This is a follow-up question of @PostConstruct of abstract ancestors are not…
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
4
votes
2 answers

How to inject a CDI managed bean that exists in another classloader

I am working on a framework which will be used in Java EE applications and therefore is likely to be deployed in the \lib directory of an EAR file. The framework will use CDI to programmatically lookup and inject beans that are located in the Java…
Paul H
  • 2,104
  • 7
  • 39
  • 53
4
votes
1 answer

WELD-001408: Unsatisfied dependencies for type Employee with qualifiers @Default

I got the following error when deploying to Glassfish on Netbeans. This is the first time I am trying to CDI. I have read all the post on this issue up to no help. Log: Info: visiting unvisited references Info: visiting unvisited…
workingman
  • 43
  • 1
  • 1
  • 4
4
votes
1 answer

WELD-001409 Ambiguous dependencies for type [EagerBeansRepository]

I'm trying to migrate my JSF application to CDI. I have implented the following changes: Added an empty beans.xml file to WEB-INF Changed @ManagedBean 's to @Named Changed All the scopes I have to CDI Scopes (Session, View, Request) Changed all…
fareed
  • 3,034
  • 6
  • 37
  • 65
4
votes
4 answers

How to setup a non-CDI bean from a 3rd party for @Inject into CDI bean

While I've found examples in CDI where you setup @Produces (kinda factory like) or using the CDI javax.enterprise.inject.spi.Unmanaged concepts, they all seem to presume that CDI will be the one creating the instance of the class on its own terms…
Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
4
votes
1 answer

Stereotype for @Inject possible?

I have a recurring annotation in my app that's injecting an object created by a CDI-producer. @Inject @FlatGeometryLive FlatGeometry geoObject; I wonder if it's possible to write a stereotype "@FlatGeometryLiveInject" so that i only have to…
VWeber
  • 1,261
  • 2
  • 12
  • 34
4
votes
1 answer

Mixing Powermock with Weld?

We have a project that uses Weld-SE for dependency injection static native methods to call a native library When writing unit tests, in order to test managed beans that interact with the native library, we'd like to mock the class on which they're…
Kricket
  • 4,049
  • 8
  • 33
  • 46
4
votes
1 answer

CDI Injecting services into JPA managed Entities

I'm sure this is strongly related to this question but the op on that question has a bit of a scenario that I'm not sure even makes sense for DI. So here's what I understand, it's generally not a good idea to try to mix a JPA Entity with a CDI Bean…
xenoterracide
  • 16,274
  • 24
  • 118
  • 243
4
votes
2 answers

Cheap way to reset weld?

We have an application that uses weld-se for CDI. For our JUnit tests, we fire up a new weld container using the following trick: WeldJUnit4Runner Since we have a lot of tests, running them gets to take a long time every time Weld has to startup and…
Kricket
  • 4,049
  • 8
  • 33
  • 46
4
votes
2 answers

how to embed weld into jetty 9 to have cdi in my java maven project?

I have a JEE7 project using CDI. I want to test that project on Jetty 9, which implements Java EE 7 Web Profile. The following link indicate that we can plug Weld into Jetty, but how ? Thanks EDIT: And, how do that with jetty-maven-plugin ? Jetty…
asicfr
  • 1,061
  • 1
  • 13
  • 30