diff --git a/src/main/java/org/springframework/guice/module/GuiceModuleMetadata.java b/src/main/java/org/springframework/guice/module/GuiceModuleMetadata.java index 2f61201..70ba84d 100644 --- a/src/main/java/org/springframework/guice/module/GuiceModuleMetadata.java +++ b/src/main/java/org/springframework/guice/module/GuiceModuleMetadata.java @@ -18,6 +18,7 @@ package org.springframework.guice.module; import java.io.IOException; import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.HashSet; import java.util.Set; @@ -96,7 +97,8 @@ public class GuiceModuleMetadata implements BindingTypeMatcher { @Override public boolean matches(String name, Type type) { - if (!matches(name) || !matches(type)) { + Type rawType = type instanceof ParameterizedType ? ((ParameterizedType)type).getRawType() : type; + if (!matches(name) || !matches(rawType)) { return false; } return true; diff --git a/src/test/java/org/springframework/guice/annotation/GuiceModuleAnnotationTests.java b/src/test/java/org/springframework/guice/annotation/GuiceModuleAnnotationTests.java index 53b50f7..ef84be4 100644 --- a/src/test/java/org/springframework/guice/annotation/GuiceModuleAnnotationTests.java +++ b/src/test/java/org/springframework/guice/annotation/GuiceModuleAnnotationTests.java @@ -16,6 +16,9 @@ package org.springframework.guice.annotation; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import java.util.HashMap; +import java.util.Map; + import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -126,5 +129,10 @@ public class GuiceModuleAnnotationTests { public Service service() { return new MyService(); } + + @Bean + public Map someParameterizedType() { + return new HashMap(); + } } }