Skip to content

Classes with abstract @Lookup methods not registered in case of classpath scanning [SPR-14550] #19118

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions