Skip to content

GuicedEE/GuicedCDI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🫘 GuicedEE CDI Bridge

JDK Build License

Guice CDI JPMS

GuicedEE CDI is a lightweight bridge that integrates Google Guice modules with Jakarta CDI runtimes. Use it when you need Guice’s module ergonomics alongside CDI-managed beans and scopes.

✨ Features

  • Bridge Guice bindings into CDI-managed applications
  • Discover Guice modules via ServiceLoader and/or JPMS providers
  • Co-existence of scopes and interceptors where supported by the host environment
  • Small surface area; keep your DI clean and modular

📦 Install (Maven)

<dependency>
  <groupId>com.guicedee</groupId>
  <artifactId>guiced-cdi</artifactId>
</dependency>

🚀 Quick Start

// 1) Provide your Guice module
public final class MyModule extends com.google.inject.AbstractModule {
  @Override protected void configure() {
    bind(Greeter.class).to(DefaultGreeter.class);
  }
}

// 2) Register via ServiceLoader (META-INF/services)
// file: META-INF/services/com.guicedee.client.IGuiceModule
//   com.example.MyModule

// 3) Start your CDI container
// The bridge exposes Guice bindings to CDI consumers when your app boots.

⚙️ Configuration

  • Register Guice modules via META-INF/services and/or JPMS provides ... with ....
  • Logging and environment toggles live in your host app; the bridge itself is configuration-light.
  • In hybrid stacks (Servlet/JAX-RS/Vert.x), ensure only one container owns lifecycle; others integrate via SPI.

🧩 JPMS & SPI

  • JPMS-friendly; dual-register services for portability (ServiceLoader + module-info.java).
  • If you export Guice modules as services, add provides com.guicedee.client.IGuiceModule with ....

🧪 Example (CDI bean consumes a Guice-provided binding)

@jakarta.enterprise.context.ApplicationScoped
public class WelcomeResource {
  @jakarta.inject.Inject Greeter greeter; // bound from MyModule

  public String hello(String name) { return greeter.greet(name); }
}

📚 Docs & Rules

  • Pact: PACT.md
  • Rules: RULES.md
  • Guides: GUIDES.md
  • Glossary: GLOSSARY.md
  • Architecture index: docs/architecture/README.md

🤝 Contributing

  • Issues/PRs welcome. Keep docs in sync with changes (forward-only policy).
  • Align terminology with the topic glossaries referenced from GLOSSARY.md.

📝 License

  • Apache License 2.0 — see LICENSE.

About

A CDI Bridge to provide beans using GuicedEE

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages