{"id":15583380,"url":"https://github.com/vmj/cdi-se-example","last_synced_at":"2025-03-29T08:23:35.371Z","repository":{"id":139271685,"uuid":"67836871","full_name":"vmj/cdi-se-example","owner":"vmj","description":"Example Java SE + CDI 2.0 applications","archived":false,"fork":false,"pushed_at":"2021-01-08T20:41:28.000Z","size":194,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-03T22:40:52.045Z","etag":null,"topics":["cdi","dependency-injection","java","java-8","java-9","java-se","java8","java9","javase"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vmj.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-09-09T22:33:34.000Z","updated_at":"2023-10-26T21:25:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"58aa183f-c651-4440-b841-931880268393","html_url":"https://github.com/vmj/cdi-se-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmj%2Fcdi-se-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmj%2Fcdi-se-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmj%2Fcdi-se-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmj%2Fcdi-se-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmj","download_url":"https://codeload.github.com/vmj/cdi-se-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246158080,"owners_count":20732717,"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","dependency-injection","java","java-8","java-9","java-se","java8","java9","javase"],"created_at":"2024-10-02T20:07:44.064Z","updated_at":"2025-03-29T08:23:35.356Z","avatar_url":"https://github.com/vmj.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"image:https://travis-ci.org/vmj/cdi-se-example.svg?branch=master[\"Build Status\", link=\"https://travis-ci.org/vmj/cdi-se-example\"]\n\n# Example Java SE + CDI 2.0 applications\n\nThis repository contains one application based on *OpenWebBeans*, and another based on *Weld SE*.\nThose are CDI containers (think dependency injection) readily usable in a Java SE environment.\nFor example, small apps or 12 factor apps.\n\n## Why and What?\n\nThink what you will about the enterprise Java as a whole, some of their technologies are really neat.\nAlso, since they are more and more usable without any heavy frameworks or boilerplate or configuration,\nthey are a real contender in Java SE space.\n\nDependency injection allows you to decouple the components of your app,\nso you don't need to spend any time thinking about constructing and wiring them up.\nCDI also takes care of lifecycle management of those components,\nso you get safe singletons without even thinking about multi-threading issues.\nCDI even has a neat event system.\nAll this with next to no annotations or configuration.\n\n## How it works\n\nThis project contains a `bean-archive`, which is just a JAR really,\nthat contains CDI compatible beans, which are just POJOs really.\nThis JAR forms the actual application.\nThere's an `App` class that listens to a CDI event to start whatever the app does,\nand a `Boot` class that contains the standard Java `main` function.\n\nThen there are two Java applications: `owb-app` and `weld-app`.\nBoth are really small.\nThey don't even contain any code;\njust a build file that instructs the build tool to compose a Java application.\n\nBoth applications use the `Boot` class from the `bean-archive` to bootstrap the application.\nAll it does is, it uses CDI 2.0 way of constructing the CDI container and then fires the\nCDI event expected by the `App` class.\n\nThat's it.  (See the source code for more comments.)\n\n## How to try it out\n\nI'm using *gradle* build system, but you do not need to install that in order to build this.\nAll you need is *Java SE JDK*, version 8 or newer. (Java 8 requirement is in CDI spec; tested with JDK 15)\n\nClone this repository:\n\n  git clone https://github.com/vmj/cdi-se-example.git\n  cd cdi-se-example\n\nThen run the OpenWebBeans based app:\n\n  ./gradlew owb-app:run\n\nAnd the Weld based app:\n\n  ./gradlew weld-app:run\n\nIf you're on Windows, use the `gradlew.bat` script instead of `./gradlew`.\n\nYou can clean up, too\n\n  ./gradlew clean\n\nHave fun!  (And see a bit more interesting example: https://github.com/vmj/swing-cdi-example)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmj%2Fcdi-se-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmj%2Fcdi-se-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmj%2Fcdi-se-example/lists"}