Currently, if a factory method is parameterized and the corresponding variable types are declared on the method itself instead of on the enclosing class or interface, Spring always predicts the return type to be Object, even if the return type can be explicitly inferred from the method signature and supplied arguments (which are available in the bean definition). This commit introduces a new resolveParameterizedReturnType() method in GenericTypeResolver that attempts to infer the concrete type for the generic return type of a given parameterized method, falling back to the standard return type if necessary. Furthermore, AbstractAutowireCapableBeanFactory now delegates to resolveParameterizedReturnType() when predicting the return type for factory methods. resolveParameterizedReturnType() is capable of inferring the concrete type for return type T for method signatures similar to the following. Such methods may potentially be static. Also, the formal argument list for such methods is not limited to a single argument. - public <T> T foo(Class<T> clazz) - public <T> T foo(Object obj, Class<T> clazz) - public <V, T> T foo(V obj, Class<T> clazz) - public <T> T foo(T obj) Issue: SPR-9493
28 lines
741 B
XML
28 lines
741 B
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
|
|
|
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
|
|
|
|
<!-- Appenders -->
|
|
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
|
<param name="Target" value="System.out" />
|
|
<layout class="org.apache.log4j.PatternLayout">
|
|
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
|
|
</layout>
|
|
</appender>
|
|
|
|
<logger name="org.springframework.core.convert">
|
|
<level value="warn" />
|
|
</logger>
|
|
|
|
<logger name="org.springframework.core.GenericTypeResolver">
|
|
<level value="warn" />
|
|
</logger>
|
|
|
|
<!-- Root Logger -->
|
|
<root>
|
|
<priority value="warn" />
|
|
<appender-ref ref="console" />
|
|
</root>
|
|
|
|
</log4j:configuration> |