Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest Http Interface configuration is verbose #32741

Closed
michaelisvy opened this issue May 1, 2024 · 2 comments
Closed

Rest Http Interface configuration is verbose #32741

michaelisvy opened this issue May 1, 2024 · 2 comments
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@michaelisvy
Copy link

michaelisvy commented May 1, 2024

Affects: Spring framwework 6.1.6

In a sample project, I have put side by side the new RestClient and the Http interface (which allows to use annotations such as @GetExchange)

    @Bean
    public RestClient restClient() {
        return RestClient.create();
    }
    
    @Bean
    StudentService invoiceServiceWithHttpInterface() {
        var restClient = RestClient.builder().baseUrl(endpointUrl).build();
        var adapter = RestClientAdapter.create(restClient);
        var factory = HttpServiceProxyFactory.builderFor(adapter).build();
        return factory.createClient(StudentService.class);
    }

Would there be a way to make the HttpInterface configuration more intuitive? Something like that would be nice:

@Bean
public StudentService invoiceServiceWithHttpInterface() {
    return RestHttpInterface.createClient(StudentService.class);
}
    

Great thanks!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 1, 2024
@snicoll
Copy link
Member

snicoll commented May 1, 2024

Please vote for spring-projects/spring-boot#31337 as it would avoid the boilerplate that you're talking about. 3 lines of code doesn't sound too bad to me (straight from the reference guide, so easy to find).

We shouldn't introduce additional high-level concepts in the core framework just so that the above can be written in one line instead of 3.

@snicoll snicoll closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
@snicoll snicoll added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels May 1, 2024
@michaelisvy
Copy link
Author

sure, thanks for your prompt answer! I agree it would be nicer to have an @enable... annotation. I've subscribed to spring-projects/spring-boot#31337

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants