Skip to content

Commit

Permalink
Add blog on Provider (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi authored Nov 19, 2023
1 parent 374754c commit 6ce74c3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/blog/2023-11-18-provider.md
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/

0 comments on commit 6ce74c3

Please sign in to comment.