Questions tagged [jboss-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). CDI is the Java standard for dependency injection and contextual lifecycle management, a Java Community Process (JCP) specification that integrates cleanly with the Java EE platform. Any Java EE 6-compliant application server provides support for JSR-299 (even the web profile).

http://seamframework.org/Weld

See also

375 questions
92
votes
7 answers

WELD-000072 Managed bean declaring a passivating scope must be passivation capable

I wrote a simple program in java web forms but i am receiving the following error: WELD-000072 Managed bean declaring a passivating scope must be passivation capable. Bean: Managed Bean [class BeanPakage.DemoBeans] with qualifiers [@Any @Default…
christina
  • 923
  • 1
  • 6
  • 6
59
votes
3 answers

CDI: beans.xml, where do I put you?

I am using Weld as CDI implementation. My integration test, that tries to assemble object graph instantiating Weld container works well, when I have empty beans.xml in src/test/java/META-INF/beans.xml. Here is that simple test: public class…
Xorty
  • 16,617
  • 21
  • 99
  • 150
58
votes
6 answers

Google Guice vs. JSR-299 CDI / Weld

Weld, the JSR-299 Contexts and Dependency Injection reference implementation, considers itself as a kind of successor of Spring and Guice. CDI was influenced by a number of existing Java frameworks, including Seam, Guice and Spring. However, CDI…
deamon
  • 78,414
  • 98
  • 279
  • 415
41
votes
4 answers

Are @ManagedBeans obsolete in JavaEE6 because of @Named in CDI/Weld?

Because of CDI (and its implementation Weld), every POJO in JEE6 can be annotated with @Named, which makes the POJO accessible to the view. Does that mean that ManagedBeans are completely obsolete now? Or did I miss something where @ManagedBean…
Wolkenarchitekt
  • 17,351
  • 28
  • 102
  • 166
40
votes
2 answers

Inject list of objects in CDI (Weld)

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…
Bozho
  • 554,002
  • 136
  • 1,025
  • 1,121
38
votes
6 answers

How to programmatically inject a Java CDI managed bean into a local variable in a (static) method

How can I programmatically inject a Java CDI 1.1+ managed bean into a local variable in a static method?
XDR
  • 3,457
  • 3
  • 23
  • 42
33
votes
8 answers

Maven Eclipse Debug "JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)"

I'm trying to debug Maven tests in Eclipse. When I launch tests with the maven option maven.surefire.debug, I get this error : ERROR: transport error 202: bind failed: Address already in use FATAL ERROR in native method: JDWP No transports…
Rémi Doolaeghe
  • 2,034
  • 3
  • 26
  • 45
30
votes
1 answer

What is Weld, JSR-299?

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…
retrodev
  • 2,143
  • 5
  • 22
  • 43
28
votes
5 answers

JSF 2.0: use Enum values for selectOneMenu

I'm using JSF 2.0 and want to fill a selectOneMenu with the values of my Enum. A simple example: // Sample Enum public enum Gender { MALE("Male"), FEMALE("Female"); private final String label; private Gender(String label) { this.label…
Wolkenarchitekt
  • 17,351
  • 28
  • 102
  • 166
27
votes
3 answers

What are the best debugging tricks with Weld/CDI?

One of the beauties with Java EE 6 is the new dependency injection framework - CDI with the Weld reference implementation - which has prompted us to start migrating internally to JSR-330 in an implementation agnostic manner, with the explicit target…
Thorbjørn Ravn Andersen
  • 68,906
  • 28
  • 171
  • 323
27
votes
1 answer

What is the default scope of a Named CDI bean?

Is there any default scope for a @Named CDI bean without additional @...Scoped annotations? I have not found any relevant information in the official Weld documentation. A @Named bean can be accessed over JSF without additional annotations, so some…
kostja
  • 56,537
  • 45
  • 164
  • 213
26
votes
3 answers

How to create a modular JSF 2.0 application?

I have an application with a well defined interface. It uses CDI for resolution of the modules, (Specifically it uses Instance<> injection points on API interfaces to resolve modules) and passes various data back and fourth via the interfaces…
SplinterReality
  • 3,360
  • 1
  • 20
  • 45
22
votes
6 answers

How to use CDI for method parameter injection?

Is it possible to use CDI to inject parameters into method calls? The expected behaviour would be similar to field injection. The preferred producer is looked up and the product is used. What I would like to do is this: public void foo(@Inject Bar…
kostja
  • 56,537
  • 45
  • 164
  • 213
21
votes
2 answers

How to inject a non-serializable class (like java.util.ResourceBundle) with Weld

I want to create a Producer that makes it possible to inject a java.util.ResourceBundle into any class in order to get localized Strings easily. My ResourceBundle-Producer looks like this: public class ResourceBundleProducer { @Inject …
Wolkenarchitekt
  • 17,351
  • 28
  • 102
  • 166
19
votes
3 answers

Injecting a bean from a different Jar in Weld

I have two Jars A and B where A depends on B. Jar B has a single class: @ApplicationScoped public class MyManagedBean { private String user; public MyManagedBean(){ //Constructor necesary for CDI } @Inject public…
narduk
  • 709
  • 1
  • 7
  • 17
1
2 3
24 25