moving private JacksonObjectMapper into companion object to establish compatibility with CGLIB proxying #694
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request type
Changes in this PR
Follow-up on PR#275 and PR#428 which were opened by my colleague @lucatk.
Since with version v4.5.1 a fix was introduced to
Avoid instantiating Jackson mappers per request
we are encountering again the issue that the@RestController
sDgsRestSchemaJsonController
andDgsSSESubscriptionHandler
are not working when provided as a CGLIB proxied bean in our enterprise application since theirmapper
s are null as soon as they are provided as a CGLIB proxied bean.This PR moves the mapper class fields into companion objects (thanks, @berngp). This should not affect any business logic or the like. Since these classes are already documented to actually be inner APIs and extending should not be performed, i don't see the need for any more communication regarding this issue on those classes.
This PR was opened with the understanding that this issue was addressed in the past as well as based on the caring and understanding statement from @paulbakker on one of the related, previous PRs.
Alternatives considered
What i could see in the future is the usage of the
kotlin-allopen
plugin especially itskotlin-spring
plugin that focuses on opening just the classes that are annotated with selected org.springframework annotations when compiling.This might make it easier to follow the kotlin paradigms without interfering with compatibility regarding established java ecosystem frameworks and approaches.
But this will not remove the need to communicate that openly provided classes should not be extended since they are open for CGLIB compatibility and not being actual public APIs of this framework.
I tried to incorporate the plugin into this project but i have not much expertise in kotlin, gradle and this projects build setup and i don't think me as a extern contributor would have a chance to incorporate it without breaking a lot of things.
Acknowledgement
Thank you for considering this PR and thank you for this amazing framework which tremendously helps to provide a solid GraphQL API with minimal effort when utilized in a Spring Boot Application context!