Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 in a Java EE 6 project?
  • If one uses it in a Java EE 6 project, what is it supplanting, if anything?
like image 310
retrodev Avatar asked Mar 02 '11 19:03

retrodev


People also ask

What is JSR 299?

JSR-299: Contexts and Dependency Injection for the Java EE platform.

What is Weld in Java?

Weld is the reference implementation of CDI: Contexts and Dependency Injection for the Java EE Platform - a JCP standard for dependency injection and contextual lifecycle management and one of the most important and popular parts of the Java EE.

What is CDI Java?

CDI (Contexts and Dependency Injection) is a standard dependency injection framework included in Java EE 6 and higher. It allows us to manage the lifecycle of stateful components via domain-specific lifecycle contexts and inject components (services) into client objects in a type-safe way.


1 Answers

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 packages.

How does it relate to Java EE 6?

JSR-299 is part of Java EE 6 (JSR-316).

How would one use it in a Java EE 6 project?

Weld or another JSR-299 implementation is already supplied by the Java EE 6 container (the application server). If yours doesn't ship with Weld, but with another JSR-299 implementation, and you want to use Weld instead, then you need to consult the documentation of the container in question how to replace it.

If one uses it in a Java EE 6 project, what is it supplanting, if anything?

Spring (as it was during the dark J2EE ages).

See also:

  • List of all (reference) implementations of JEE6
  • Introduction to Weld
like image 144
BalusC Avatar answered Sep 19 '22 13:09

BalusC