Is your feature request related to a problem? Please describe.
When generating a Kotlin HTTP Interface client with kotlin-spring + library=spring-declarative-http-interface (Spring Boot 4 / Security 7), the generated API interfaces do not include @ClientRegistrationId. Without that annotation, Spring Security’s OAuth2 HTTP Service Client integration does not attach tokens for client_credentials (or other registrations).
The Java spring generator already supports this via clientRegistrationId (library=spring-http-interface, useSpringBoot4=true) — see PR #22726 and the spring generator docs. kotlin-spring has no equivalent option, so Kotlin users must post-process generated *Api.kt files.
Describe the solution you'd like
Add a clientRegistrationId config option to kotlin-spring with the same semantics as the Java spring generator:
- When set, and
library=spring-declarative-http-interface (with Boot 4 / Security 7 as required), emit @ClientRegistrationId("<id>") on the generated interface.
- Document the option in
kotlin-spring docs.
Example:
generatorName: kotlin-spring
library: spring-declarative-http-interface
additionalProperties:
useSpringBoot4: "true"
interfaceOnly: "true"
clientRegistrationId: assistant
Expected:
@ClientRegistrationId("assistant")
interface DocumentsApi {
// ...
}
Describe alternatives you've considered
- Gradle
doLast workaround: inject @ClientRegistrationId into generated *Api.kt after generation (what we do today).
- Switch the client generator to Java
spring + spring-http-interface (works, but mixes Java clients into a Kotlin service and splits server/client generators).
- Manual/non-generated HTTP interfaces.
Additional context
Is your feature request related to a problem? Please describe.
When generating a Kotlin HTTP Interface client with
kotlin-spring+library=spring-declarative-http-interface(Spring Boot 4 / Security 7), the generated API interfaces do not include@ClientRegistrationId. Without that annotation, Spring Security’s OAuth2 HTTP Service Client integration does not attach tokens forclient_credentials(or other registrations).The Java
springgenerator already supports this viaclientRegistrationId(library=spring-http-interface,useSpringBoot4=true) — see PR #22726 and the spring generator docs.kotlin-springhas no equivalent option, so Kotlin users must post-process generated*Api.ktfiles.Describe the solution you'd like
Add a
clientRegistrationIdconfig option tokotlin-springwith the same semantics as the Javaspringgenerator:library=spring-declarative-http-interface(with Boot 4 / Security 7 as required), emit@ClientRegistrationId("<id>")on the generated interface.kotlin-springdocs.Example:
Expected:
Describe alternatives you've considered
doLastworkaround: inject@ClientRegistrationIdinto generated*Api.ktafter generation (what we do today).spring+spring-http-interface(works, but mixes Java clients into a Kotlin service and splits server/client generators).Additional context
@ClientRegistrationIdon the interface or methods).clientRegistrationId, PR [Spring] Add clientRegistrationId option for OAuth2 HTTP Interface #22726.spring-declarative-http-interface; noclientRegistrationIdin kotlin-spring docs.7.25.0.