I have a JSF 2 application that includes a jar file which in turn contains a faces-config.xml in its META-INF directory. The faces-config.xml contains a declaration of a phase-listener. I would like to prevent the installation of this phase listener without modifying the jar file itself. Is this possible?
You can't block specific parts of faces-config.xml
in a 3rd party JAR from being interpreted.
You have basically 2 options:
Block the whole faces-config.xml
in a 3rd party JAR from being interpreted by adding metadata-complete="true"
to webapp's own faces-config.xml
.
<faces-config ... metadata-complete="true">
Note that this also skips annotation scans in classes of the 3rd party JAR. You'd basically need to redefine specific parts you'd like to use in webapp's own faces-config.xml
.
Provide a custom Lifecycle
implementation via LifecycleFactory
which you register in <factory><lifecycle-factory>
of webapp's faces-config.xml
. In that implementation, override addPhaseListener()
accordingly to perform e.g. an instanceof
check before skipping or continuing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With