Skip to content

refactor: make UserService members protected for extensibility#33841

Open
Sarthak123-work wants to merge 4 commits into
jhipster:mainfrom
Sarthak123-work:fix-user-service-protected-members
Open

refactor: make UserService members protected for extensibility#33841
Sarthak123-work wants to merge 4 commits into
jhipster:mainfrom
Sarthak123-work:fix-user-service-protected-members

Conversation

@Sarthak123-work

Copy link
Copy Markdown

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

Copilot AI review requested due to automatic review settings June 21, 2026 08:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 final dependency fields to protected final in UserService.
  • Changed helper methods (removeNonActivatedUser, getUser, clearUserCaches) from private to protected (including static where 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.
}


@mshima mshima closed this Jun 25, 2026
@mshima mshima reopened this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants