Skip to content

Add value alias to @ImportGrpcClients - #400

Merged
dsyer merged 1 commit into
spring-projects:mainfrom
therepanic:gh-398
Apr 21, 2026
Merged

dsyer merged 1 commit into
spring-projects:mainfrom
therepanic:gh-398

Conversation

@therepanic

Copy link
Copy Markdown
Contributor

Add a value attribute to @ImportGrpcClients as an alias for types, aligning with @ImportHttpServices and allowing the shorter form @ImportGrpcClients(Foo.class).

Closes: gh-398

Add a `value` attribute to `@ImportGrpcClients` as an alias for `types`,
aligning with `@ImportHttpServices` and allowing the shorter form
`@ImportGrpcClients(Foo.class)`.

Closes: spring-projectsgh-398

Signed-off-by: Andrey Litvitski <andrey1010102008@gmail.com>
@dsyer
dsyer merged commit dc9a7d3 into spring-projects:main Apr 21, 2026
6 checks passed
@dsyer

dsyer commented Apr 21, 2026

Copy link
Copy Markdown
Member

Seems unlikely to braeak anything. I'm still not sure what happens if the target is not specified.

@dsyer dsyer added this to the 1.1.0 milestone Apr 21, 2026
@dsyer dsyer added the enhancement New feature or request label Apr 21, 2026
@therepanic

therepanic commented Apr 21, 2026 •

Copy link
Copy Markdown
Contributor Author

So, I did a little research on this issue.

If we refer to the autoconfiguration logic we moved to Spring Boot, we'll see that with default we'll use the default "static://localhost:9090".

In general, I suggest we think about this. I can suggest the following:

We could force a custom target to be specified, whether as a property or an annotation parameter, and if it's not specified, we would return an error log. After that, we could remove the hardcoded code from Spring Boot's autoconfiguration.

This would be consistent with the logic behind, for example, @EnableJpaRepositories. After all, when we use this annotation, we don't connect to jdbc:h2:mem:default by default, and we see an error.

This would be the right thing to do, I think, and I can open an issue about it and we can figure out a solution.

@therepanic

Copy link
Copy Markdown
Contributor Author

This doesn't make sense now, because if the user forgets to specify their URL, they will see an error that the connection to localhost:9090 has been broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add value alias to ImportGrpcClients annotation.

2 participants