Modify to use BeanDefinitionRegistryPostProcessor

Also set guice binding source to "spring-guice" to avoid duplicate beans

Fixes gh-5
This commit is contained in:
Taylor Wicksell
2016-01-27 12:15:47 -08:00
committed by Dave Syer
parent 2698b4e3e3
commit 71f1c363cc
5 changed files with 83 additions and 40 deletions

View File

@@ -37,7 +37,7 @@ public class SimpleWiringTests {
assertNotNull(app.getInstance(Foo.class));
}
protected static class TestConfig extends AbstractModule {
public static class TestConfig extends AbstractModule {
@Override
protected void configure() {
bind(Service.class).to(MyService.class);
@@ -47,10 +47,10 @@ public class SimpleWiringTests {
interface Service {
}
protected static class MyService implements Service {
public static class MyService implements Service {
}
protected static class Foo {
public static class Foo {
@Inject
public Foo(Service service) {

View File

@@ -16,6 +16,7 @@ package org.springframework.guice.annotation;
import static org.junit.Assert.assertNotNull;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -49,6 +50,9 @@ public class ModuleBeanWiringTests extends AbstractCompleteWiringTests {
@EnableGuiceModules
@Configuration
public static class TestConfig extends AbstractModule {
@Autowired Service service;
@Override
protected void configure() {
bind(Service.class).to(MyService.class);