Skip to content

fix(parametermanager): fix invalid bean definition named 'clientFactory'#4127

Merged
jinseopkim0 merged 4 commits intoGoogleCloudPlatform:mainfrom
suvidha-malaviya:fix(issues-4117)-invalid-bean-definition
Sep 11, 2025
Merged

fix(parametermanager): fix invalid bean definition named 'clientFactory'#4127
jinseopkim0 merged 4 commits intoGoogleCloudPlatform:mainfrom
suvidha-malaviya:fix(issues-4117)-invalid-bean-definition

Conversation

@suvidha-malaviya
Copy link
Copy Markdown
Contributor

@suvidha-malaviya suvidha-malaviya commented Sep 8, 2025

Issue: #4117

Changes:

  • Make Parameter Manager as optional dependency in AutoConfigure module.
  • Changed the clientFactory bean name for both Secret Manager and Parameter Manager.
    • Technically this is a breaking change. However, given that the modules were only released recently, and given that the names were different from the convention, we are proceeding with this change.
  • Added logic to resolve the registered bean in spring.factories only if the class is present in the classpath for Parameter Manager.
  • Added parameter manager module and starter module in spring-cloud-gcp-dependencies.

Testing:

  • Created project which uses secretManager
  • Created project which uses parameterManager
  • Created project which uses secretManager and parameterManager

@suvidha-malaviya suvidha-malaviya force-pushed the fix(issues-4117)-invalid-bean-definition branch from a42c421 to f83f800 Compare September 8, 2025 06:59
@suvidha-malaviya suvidha-malaviya changed the title fix(issues-4117)- Fixed invalid bean definition with name 'clientFactory' fix(parametermanager)- Fixed invalid bean definition with name 'clientFactory' Sep 8, 2025
@suvidha-malaviya suvidha-malaviya changed the title fix(parametermanager)- Fixed invalid bean definition with name 'clientFactory' fix(parametermanager): fix invalid bean definition named 'clientFactory' Sep 8, 2025
@suvidha-malaviya suvidha-malaviya force-pushed the fix(issues-4117)-invalid-bean-definition branch from f83f800 to 5f23214 Compare September 8, 2025 07:02
@Bean
@ConditionalOnMissingBean
public SecretManagerServiceClientFactory clientFactory() {
public SecretManagerServiceClientFactory secretManagerClientFactory() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This change is backwards incompatible, right?
If anyone is using the auto-configured bean ("clientFactory") then after this change that will result in error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this change is backward-incompatible. However, the impact should be minimal, as the auto-configured clientFactory bean was mainly introduced to support global with multi-regional functionality and is not expected to be directly used by most users.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@jinseopkim0 What do you think about the bean name changes?

void testParameterManagerDependencyWithoutConfigImportShouldNotCrash() {
contextRunner
.withConfiguration(AutoConfigurations.of(GcpSecretManagerAutoConfiguration.class))
.run(ctx -> assertThat(ctx).hasSingleBean(ParameterManagerClientFactory.class));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Let's assert that ctx has a bean for SecretManagerClientFactory.class as well - given that we are autoconfiguring SM beans as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added test case for this.

@suvidha-malaviya suvidha-malaviya marked this pull request as ready for review September 11, 2025 05:37
@suvidha-malaviya suvidha-malaviya requested a review from a team as a code owner September 11, 2025 05:37
@jinseopkim0 jinseopkim0 merged commit 1c98540 into GoogleCloudPlatform:main Sep 11, 2025
11 checks passed
blakeli0 pushed a commit that referenced this pull request Sep 15, 2025
🤖 I have created a release *beep* *boop*
---


##
[7.3.1](v7.3.0...v7.3.1)
(2025-09-15)


### Bug Fixes

* **deps:** update dependency com.google.cloud:libraries-bom to v26.68.0
([#4136](#4136))
([2335f17](2335f17))
* **deps:** update gapic-generator-java-bom.version to v2.62.1
([#4135](#4135))
([7010534](7010534))
* **parametermanager:** fix invalid bean definition named
'clientFactory'
([#4127](#4127))
([1c98540](1c98540))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 added a commit that referenced this pull request Sep 26, 2025
Backports the following PRs to 3.x: #3699, #3684, #4127
jinseopkim0 pushed a commit that referenced this pull request Sep 26, 2025
…ry' (#4127)

Issue:
[#4117](#4117)

Changes:

- Make Parameter Manager as `optional dependency` in AutoConfigure
module.
- Changed the `clientFactory` bean name for both Secret Manager and
Parameter Manager.
- Added logic to resolve the registered bean in `spring.factories` only
if the class is present in the classpath for Parameter Manager.
- Added parameter manager module and starter module in
`spring-cloud-gcp-dependencies`.

Testing:
- [x] Created project which uses secretManager
- [x] Created project which uses parameterManager
- [x] Created project which uses secretManager and parameterManager
jinseopkim0 added a commit that referenced this pull request Sep 26, 2025
Backports the following PRs to 3.x: #3699, #3684, #4127
jinseopkim0 added a commit that referenced this pull request Sep 26, 2025
Backports the following PRs to 3.x: #3699, #3684, #4127
jinseopkim0 added a commit that referenced this pull request Sep 26, 2025
Backports the following PRs to 3.x: #3699, #3684, #4127
jinseopkim0 added a commit that referenced this pull request Sep 29, 2025
Backports the following PRs to 6.x: #3699, #3684, #4127

---------

Co-authored-by: suvidha-malaviya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants