This repository contains a Cdi2 application which demonstrates a dependency injection issue in the jersey-media-jaxb library from version 3.1.2 and higher.
- It instantiates a CDI Container
- Produces a default Jersey Client
- Produces a WebResource / Proxy client using the interface XmlNotesApi
- Injects the Proxy Client into the application (CdiSeApplication)
- Invokes getNote() to fetch https://www.w3schools.com/xml/note.xml and parses the xml response using jaxb
Successful output:
XmlNote{to='Tove', from='Jani', heading='Reminder', body='Don't forget me this weekend!'}
./gradlew build
./gradlew run
The settings.gradle file contains jersey, jaxb, weld library definitions and versions. For the libraries that are actually used in this demo; look at the build.gradle dependencies section.
To change the demo from non-working to working explicitly set the version of jersey-media-jaxb library used to 3.1.1 in the settings.gradle file
- .versionRef('jerseyVersion')
+ .version('3.1.1')