Skip to content

Commit 92b0eb7

Browse files
committed
Add HTTP Service registry support
See gh-33992
1 parent a63c5ad commit 92b0eb7

File tree

25 files changed

+1924
-1
lines changed

25 files changed

+1924
-1
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2002-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.web.client.support;
18+
19+
import org.springframework.web.client.RestClient;
20+
import org.springframework.web.service.invoker.HttpExchangeAdapter;
21+
import org.springframework.web.service.registry.HttpServiceGroupAdapter;
22+
import org.springframework.web.service.registry.HttpServiceGroupConfigurer;
23+
24+
/**
25+
* Adapter for groups backed by {@link RestClient}.
26+
*
27+
* @author Rossen Stoyanchev
28+
* @since 7.0
29+
*/
30+
@SuppressWarnings("unused")
31+
public class RestClientHttpServiceGroupAdapter implements HttpServiceGroupAdapter<RestClient.Builder> {
32+
33+
@Override
34+
public RestClient.Builder createClientBuilder() {
35+
return RestClient.builder();
36+
}
37+
38+
@Override
39+
public Class<? extends HttpServiceGroupConfigurer<RestClient.Builder>> getConfigurerType() {
40+
return RestClientHttpServiceGroupConfigurer.class;
41+
}
42+
43+
@Override
44+
public HttpExchangeAdapter createExchangeAdapter(RestClient.Builder clientBuilder) {
45+
return RestClientAdapter.create(clientBuilder.build());
46+
}
47+
48+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2002-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.web.client.support;
18+
19+
import org.springframework.web.client.RestClient;
20+
import org.springframework.web.service.registry.HttpServiceGroupConfigurer;
21+
22+
/**
23+
* Extension of {@link HttpServiceGroupConfigurer} to configure groups
24+
* with a {@link RestClient}.
25+
*
26+
* @author Rossen Stoyanchev
27+
* @since 7.0
28+
*/
29+
public interface RestClientHttpServiceGroupConfigurer extends HttpServiceGroupConfigurer<RestClient.Builder> {
30+
31+
}

0 commit comments

Comments
 (0)