Open fmhwong opened 1 year ago
CDI is disabled for performance reasons if there are no beans or extensions in the application.
Therefore, servlet filters (or any other EE component) registered by liberty features must not depend on CDI being enabled unless they can guarantee that the application will contain at least one bean.
This has the same cause as #26043
Running a simple servlet with
mpTelemetry-1.0
feature. There are no CDI beans in the application.A servlet filter is registered programmatically with
ServletContainerInitializer.onStartup()
. The injection constructor wasn't called.Alternatively, using the following line in the
init()
of the servlet filter.and it failed with
Both of the above work when running with a JAX-RS application.