My Oracle Support Banner

Only Direct Subclasses Are Injected (Doc ID 2133512.1)

Last updated on AUGUST 21, 2023

Applies to:

Oracle WebLogic Server - Version 12.2.1.0.0 and later
Information in this document applies to any platform.

Goal

When attempting to inject a collection of beans using the @Any annotation only the beans directly implementing the specified interface (e.g. Interface_Name in @Inject @Any Instance<Interface_Name> instance) are
injected. Indirect subclasses are not injected.

For example, when attempting to deploy an  application on WebLogic 12.2.1 which currently running on 12.1.2 faced an issue with the injection:

The  following is the hierarchy

Wm6Timer (interface)
- AbstractWm6Timer (abstract class)
- - HostMessageSenderTimer
- - ReplenishmentTimer
- JanitorServiceImpl
- ViewServerImpl

At startup a service injects all timers:
@Inject
@Any
Instance instance.

But when iterating over instance, there are only two timers (JanitorServiceImpl and ViewServerImpl). All subclassses of AbstractWm6Timer are missing.

It's the same result for the bean manager:
beanManager.getBeans(Wm6Timer.class, new AnnotationLiteral)
 

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.