Description
Manfred Quasten opened SPR-14550 and commented
@Service
("exchangeRateService")
class ExchangeRateServiceImpl implements ExchangeRateService {
...
@Lookup
ExchangeRateCalculatorBuilder newBuilder() {
return null;
}
}
the newBuilder Method is used inside an other public method and it works fine.
But when I will make the service class and the method newBuilder abstract then an exception is thrown:
No qualifying bean of type [de.mq.portfolio.exchangerate.support.ExchangeRateService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.
Ok, I can understand, that the spring container will not instantiate abstract classes but when only methods for methodInjection are abstract the bean can be instantiated. It is enhanced by cglib or what ever and it works as I've tried without abtract. For the (cglib) proxy there is no difference if an abstract or an other method will be overwritten. It is not very esthetic to write the dummy method returning null or what ever and it is not nesseary. In case of an abstract class that has only abstract methods for method injection the container can instantite the proxy.
Affects: 4.2.5
Attachments:
- methodinjection.test.zip (7.89 kB)
Issue Links:
- Introduce a mechanism for abstract types at component scanning [SPR-11663] #16286 Introduce a mechanism for abstract types at component scanning