This project shows how quarkus-infinispan-client stops generating serialization context initializer and marshallers when using mapstruct-processor which generates mappers from specific Interfaces containing mapping directives.
Run the application as-is (without mapstruct-processor) with
./mvnw compile quarkus:dev
- jaxb stuff is generated through xjc (driven by maven-jaxb2-plugin)
- the FileLoadRouter will parse the file books.xm located under test/resources
- each record is unmarshalled into org.acme.jaxb.BookForm
- mapped to org.acme.model.Book (with @ProtoField annotations) by the bean org.acme.process.Mapper
- finally printed to the console (no remote cache is defined for simplicity).
As said, the org.acme.model.Book fields are annotated with @ProtoField and the class itself is included in the org.acme.model.CatalogSchema interface that extends SerializationContextInitializer. Therefore, after compiling, you will find CatalogSchemaImpl.class generated into the target directory besides the Book$__marshaller
In order to recreate the issue:
- open the org.acme.processor.Mapper source,
- uncomment the constructor with mapper injection
- comment the hardMap method call
- uncomment the direct call to the mapstruct mapper
- at the same time in the pom uncomment configuration of mapstruct-processor under maven-compiler-plugin
- and execute
./mvnw compile quarkus:dev
You will notice that everything keeps working fine, but CatalogSchemaImpl.class and Book$__marshaller will not be generated anymore. So in a real project if there was the remote cache in place it would not work due to the lack of the necessary classes