Only Direct Subclasses Are Injected (Doc ID 2133512.1)

Last updated on NOVEMBER 05, 2016

Applies to:

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

Goal

On : 12.2.1.0.0 version, Application Container - JavaEE

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

Sign In with your My Oracle Support account

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

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms