Skip to content

takuti-sandbox/spring-guice-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Example: spring-guice

Guice and Spring are major Dependency Injection (DI) frameworks in Java. This example demonstrates how to apply Spring-based injection logic to Guice-based applications by leveraging spring-guice.

In short, spring-guice enables you to build an injector that mixes Spring and Guice module as follows:

AnnotationConfigApplicationContext context = 
        new AnnotationConfigApplicationContext(SpringAppConfig.class);

Injector injector = Guice.createInjector(new SpringModule(context), new GuiceModule());

GuiceApp app = injector.getInstance(GuiceApp.class);

Read "Cross-Framework Dependency Injection with spring-guice" for the details.

References:

Releases

No releases published

Packages

No packages published

Languages