{"id":23095038,"url":"https://github.com/microbean/microbean-jaxrs-cdi","last_synced_at":"2025-10-16T09:15:41.115Z","repository":{"id":80768342,"uuid":"191850517","full_name":"microbean/microbean-jaxrs-cdi","owner":"microbean","description":"A Java library that integrates some JAX-RS constructs into CDI idiomatically.","archived":false,"fork":false,"pushed_at":"2020-02-17T05:50:34.000Z","size":1030,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T17:04:01.909Z","etag":null,"topics":["cdi","cdi-extension","cdi2","cdi20","java","java-library"],"latest_commit_sha":null,"homepage":"https://microbean.github.io/microbean-jaxrs-cdi/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microbean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-14T00:28:09.000Z","updated_at":"2020-09-29T14:45:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f635d03-ca5c-4f77-b71b-ad5a4b6442af","html_url":"https://github.com/microbean/microbean-jaxrs-cdi","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microbean%2Fmicrobean-jaxrs-cdi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microbean%2Fmicrobean-jaxrs-cdi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microbean%2Fmicrobean-jaxrs-cdi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microbean%2Fmicrobean-jaxrs-cdi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microbean","download_url":"https://codeload.github.com/microbean/microbean-jaxrs-cdi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247063823,"owners_count":20877510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cdi","cdi-extension","cdi2","cdi20","java","java-library"],"created_at":"2024-12-16T22:19:18.849Z","updated_at":"2025-10-16T09:15:41.019Z","avatar_url":"https://github.com/microbean.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# microBean™ Jakarta RESTful Web Services CDI Integration\n\n[![Build Status](https://travis-ci.com/microbean/microbean-jaxrs-cdi.svg?branch=master)](https://travis-ci.com/microbean/microbean-jaxrs-cdi)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.microbean/microbean-jaxrs-cdi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.microbean/microbean-jaxrs-cdi)\n\nThe microBean™ Jakarta RESTful Web Services CDI Integration project\nintegrates certain implementation-agnostic [Jakarta RESTful Web\nServices](https://jakarta.ee/specifications/restful-ws/2.1/)\nconstructs into [CDI 2.0](https://jakarta.ee/specifications/cdi/2.0/)\nenvironments in an idiomatic way.\n\n## Installation\n\nInclude this library as a `runtime`-scoped dependency of your CDI-based Maven project:\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003eorg.microbean\u003c/groupId\u003e\n  \u003cartifactId\u003emicrobean-jaxrs-cdi\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.8\u003c/version\u003e\n  \u003cscope\u003eruntime\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\n## What This Project Does Not Provide\n\nThis project does not provide a Jakarta RESTful Web Services\nimplementation (such as [Eclipse\nJersey](https://projects.eclipse.org/projects/ee4j.jersey)).  However,\nif such a product is present on the runtime classpath and integrated\ninto CDI, then the beans synthesized by this project may prove useful\nin such a situation.\n\nThis project does not provide a web server or a [Jakarta\nServlet](https://jakarta.ee/specifications/servlet/) implementation.\nIt is solely concerned with ensuring that certain Jakarta RESTful Web\nServices constructs are properly represented as CDI beans, to be used,\nor not, in an unspecified manner, by other CDI-based projects.\n\n## Usage\n\nThe CDI portable extension supplied by this project, when present on\nthe runtime classpath, will, at application startup time, begin by\nasking CDI for beans that can produce instances of\n[`javax.ws.rs.core.Application`](https://jakarta.ee/specifications/restful-ws/2.1/apidocs/javax/ws/rs/core/Application.html).\n\n### No `Application` Present\n\nLet's say that for any one of a variety of possible reasons CDI is\nunable to locate any such beans.\n\nThe portable extension will ask CDI for all beans that it knows about\nthat meet the conditions for being a root resource class (typically\nthis means having a\n[`@Path`](https://jakarta.ee/specifications/restful-ws/2.1/apidocs/javax/ws/rs/Path.html)\nannotation on the class).  Beans will be synthesized for all of them,\nand all of them will gain the additional\n[`ResourceClass`](https://microbean.github.io/microbean-jaxrs-cdi/apidocs/org/microbean/jaxrs/cdi/JaxRsExtension.ResourceClass.html)\nqualifier, and all of them will be placed into the CDI container for\ninjection and processing elsewhere within the CDI ecosystem.\n\nThe portable extension will also ask CDI for all provider classes\n(typically ones annotated with\n[`Provider`](https://jakarta.ee/specifications/restful-ws/2.1/apidocs/javax/ws/rs/ext/Provider.html))\nand will synthesize beans for all of them.\n\nAdditionally, an\n[`Application`](https://jakarta.ee/specifications/restful-ws/2.1/apidocs/javax/ws/rs/core/Application.html)\nimplementation will be synthesized just-in-time whose\n[`getClasses()`](https://jakarta.ee/specifications/restful-ws/2.1/apidocs/javax/ws/rs/core/Application.html#getClasses--)\nmethod, if called, would return all the classes (root resource classes\nand provider classes) for which beans will have been just synthesized.\nThe `Application` and all of the synthetic beans will be made\ninjectable according to CDI's rules.\n\n### `Application` Present\n\nLet's now consider the case where CDI finds an `Application` bean.\n\nThe portable extension will [create a contextual instance of, not\nacquire a contextual reference\nto](https://jakarta.ee/specifications/cdi/2.0/apidocs/javax/enterprise/context/spi/Context.html#get-javax.enterprise.context.spi.Contextual-javax.enterprise.context.spi.CreationalContext-),\nthat `Application` bean that will live just long enough for its\n[`getClasses()`](https://jakarta.ee/specifications/restful-ws/2.1/apidocs/javax/ws/rs/core/Application.html#getClasses--)\nmethod to be invoked.  (The `Application` instance so created will be\n[destroyed\nproperly](https://jakarta.ee/specifications/cdi/2.0/apidocs/javax/enterprise/context/spi/AlterableContext.html#destroy-javax.enterprise.context.spi.Contextual-)\nshortly thereafter.)\n\nIf that `Application`'s `getClasses()` method returns `null` or an\nempty `Set`, then the behavior of the portable extension will be\nexactly that described above.\n\nIf instead that `Application`'s `getClasses()` returns a non-`null`,\nnon-empty `Set` of classes, then beans will be synthesized for all\nelements in that return value.\n\n#### `ApplicationPath` Support\n\nThe portable extension supports\n[`ApplicationPath`](https://jakarta.ee/specifications/restful-ws/2.1/apidocs/javax/ws/rs/ApplicationPath.html)\nby creating synthesizing a bean for it in `Singleton` scope.\n\n### Qualifiers and Multiple `Application`s\n\nThroughout this process, CDI\n[qualifiers](https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#qualifiers)\nare respected and used to group applications and their resources\ntogether.\n\nBy default, every bean in the CDI ecosystem, unless otherwise\nqualified, behaves as though it has the\n[`Default`](https://jakarta.ee/specifications/cdi/2.0/apidocs/javax/enterprise/inject/Default.html)\nand\n[`Any`](https://jakarta.ee/specifications/cdi/2.0/apidocs/javax/enterprise/inject/Any.html)\nqualifiers on it.  So if no qualifiers appear on `Application` classes\nand no qualifiers appear on any root resource classes or provider\nclasses everything works the way you would expect.\n\nEverything also works if there are different sets of qualifiers\npresent on things.  So, for example, if an `Application` bean is\nqualified with, say, `@Yellow`, and returns `null` from its\n`getClasses()` method, then any beans representing root resource classes that are also qualified with\n`@Yellow` will be associated with that `Application`, and with none\nother.  On the other hand, if there are beans in this same CDI\napplication representing root resource classes but that are not\nqualified with `@Yellow`, then those root resource classes will form\nan _additional_ `Application`, in this case a synthetic one.\n\nThe net result here would be _two_ `Application`s running together\nunder the same classloader: a synthetic `Application` qualified with\n`@Default` and `@Any`, whose `getClasses()` method will return root\nresource classes and provider classes also qualified with `@Default`\nand `@Any`, and the user-supplied, `@Yellow`-qualified `Application`\nwhose affiliated root resource classes and provider classes are\nqualified with `@Yellow`.\n\nObviously with most Jakarta RESTful Web Services implementations two\n`Application`s may have trouble running together, particularly if they\nare not further distinguished by non-equal\n[`@ApplicationPath`](https://jakarta.ee/specifications/restful-ws/2.1/apidocs/javax/ws/rs/ApplicationPath.html)\nannotations.\n\n## Related Projects\n\n* [microBean™ Jersey Netty Integration](https://microbean.github.io/microbean-jersey-netty/)\n* [microBean™ Jersey Netty CDI Integration](https://microbean.github.io/microbean-jersey-netty-cdi/)\n* [Eclipse Jersey](https://projects.eclipse.org/projects/ee4j.jersey)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrobean%2Fmicrobean-jaxrs-cdi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrobean%2Fmicrobean-jaxrs-cdi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrobean%2Fmicrobean-jaxrs-cdi/lists"}