-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
slug: provider | ||
title: Provider v.s. @Provider | ||
authors: jiaqi | ||
tags: [Java] | ||
--- | ||
|
||
A **Provider** is an interface defined in [JSR 330][JSR 330 Provider]. It is part of the _general_ dependency | ||
injection concept in Java. | ||
|
||
Whether we are on Java SR or EE, Provider will always be loadable from classpath. For example, the [HK2] is an | ||
implementation of JSR-330 in a JavaSE environment and it conforms to the JSR 330 standard by loading the | ||
[Provider][JSR 330 Provider] in its implementations. | ||
|
||
**@Provider**, on the other hand, is a | ||
[_Java EE/Jakarta EE concept_](https://github.com/jakartaee/rest/blob/master/jaxrs-api/src/main/java/jakarta/ws/rs/ext/Provider.java). | ||
If we are developing Java EE applications, we can use both (`Provider` & `@Provider`) at the same time. | ||
|
||
[JSR 330 Provider]: https://qubitpi.github.io/javax-inject/api/javax/inject/Provider.html | ||
[HK2]: https://qubitpi.github.io/glassfish-hk2/ |