From 9a8af0efd63e6cee889e282bcbd922d4df7f9e0c Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 21 Dec 2017 16:18:02 +0000 Subject: [PATCH] Add another test See gh-26 --- .../annotation/EnableGuiceModulesTests.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/springframework/guice/annotation/EnableGuiceModulesTests.java b/src/test/java/org/springframework/guice/annotation/EnableGuiceModulesTests.java index e696a3d..0e28264 100644 --- a/src/test/java/org/springframework/guice/annotation/EnableGuiceModulesTests.java +++ b/src/test/java/org/springframework/guice/annotation/EnableGuiceModulesTests.java @@ -51,6 +51,14 @@ public class EnableGuiceModulesTests { context.close(); } + @Test + public void moduleBean() { + AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( + ModuleBeanConfig.class); + assertNotNull(context.getBean(Foo.class)); + context.close(); + } + interface Service { } @@ -88,7 +96,23 @@ public class EnableGuiceModulesTests { @Configuration @EnableGuiceModules - protected static class ModuleConfig { + protected static class ModuleConfig extends AbstractModule { + + @Override + protected void configure() { + bind(Service.class).to(MyService.class); + } + + @Bean + public Foo service(Service service) { + return new Foo(service); + } + + } + + @Configuration + @EnableGuiceModules + protected static class ModuleBeanConfig { @Bean public MyModule module() {