Ensure a concrete type with parametrric subtype is detected
If user defines their own @Beans from conrete types that implement Function<...> then their type signature is detectable from the class.
This commit is contained in:
@@ -211,6 +211,17 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
.isAssignableFrom(Integer.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nonParametericTypeFunction() {
|
||||
create(NonParametricTypeSingletonConfiguration.class);
|
||||
assertThat(context.getBean("function")).isInstanceOf(Function.class);
|
||||
assertThat(catalog.lookupFunction("function")).isInstanceOf(Function.class);
|
||||
assertThat(inspector.getInputType(catalog.lookupFunction("function")))
|
||||
.isAssignableFrom(Integer.class);
|
||||
assertThat(inspector.getInputWrapper(catalog.lookupFunction("function")))
|
||||
.isAssignableFrom(Integer.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void componentScanBeanFunction() {
|
||||
create(ComponentScanBeanConfiguration.class);
|
||||
@@ -487,6 +498,15 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@Configuration
|
||||
protected static class NonParametricTypeSingletonConfiguration {
|
||||
@Bean
|
||||
public SingletonFunction function() {
|
||||
return new SingletonFunction();
|
||||
}
|
||||
}
|
||||
|
||||
protected static class SingletonFunction implements Function<Integer, String> {
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user