refactor: make UserService members protected for extensibility#33841
Open
Sarthak123-work wants to merge 4 commits into
Open
refactor: make UserService members protected for extensibility#33841Sarthak123-work wants to merge 4 commits into
Sarthak123-work wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Spring Boot UserService Java template to improve subclass-based customization by widening the visibility of selected members from private to protected, enabling cleaner extension without modifying generated code.
Changes:
- Changed several
private finaldependency fields toprotected finalinUserService. - Changed helper methods (
removeNonActivatedUser,getUser,clearUserCaches) fromprivatetoprotected(includingstaticwhere applicable).
Comments suppressed due to low confidence (1)
generators/spring-boot/templates/src/main/java/package/entityPackage/service/UserService.java.ejs:1108
- The template now ends with two extra blank lines after the closing brace. This changes generated output unnecessarily and may create noisy diffs in generated projects.
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
This PR changes the access modifiers of selected fields and helper methods in UserService from private to protected.
Motivation
JHipster recommends subclass-based customization to avoid modifying generated code directly. However, private members in UserService prevent subclasses from accessing dependencies and helper methods, forcing duplication or direct modification of generated files.
Changing these members to protected enables clean extension while preserving upgrade safety.
Changes
private final fields → protected final
private helper methods → protected
Impact
No behavioral changes
No API changes
Binary compatible
Improves support for subclass-based customization
Fixes #vw98075