Skip to content

Commit 1132e82

Browse files
velodependabot[bot]github-actions[bot]
authored
refactor: split feign-core into feign-api and feign-core
* refactor: split feign-core into feign-api and feign-core - Created a new feign-api module and relocated all core interfaces, annotations, and builders (including Feign) there. - Retained vanilla Java SDK default implementations in feign-core under feign.core.* subpackages to avoid split packages and JPMS issues. - Integrated ServiceLoader and ServiceLoaderUtils in feign-api to dynamically resolve default implementations. - Ensured non-core SPI implementations are favored over feign-core defaults when multiple providers exist. - Updated all submodules to use corrected imports and test configurations. - Fixed Vertx connection leak tests and Http2 client tests to prevent flakiness and run smoothly in sandbox environments. * Publish feign-bom as a real module so it auto-deploys to Central Signed-off-by: Marvin Froeder <velo.br@gmail.com> * refactor: update integration modules to compile against feign-api and delete deprecated Default inner classes * Fix flaky vertx http2NoConnectionLeak test by using h2c prior knowledge Signed-off-by: Marvin Froeder <velo.br@gmail.com> * build(deps): Bump netty.version from 4.2.14.Final to 4.2.15.Final Bumps `netty.version` from 4.2.14.Final to 4.2.15.Final. Updates `io.netty:netty-bom` from 4.2.14.Final to 4.2.15.Final - [Release notes](https://github.com/netty/netty/releases) - [Commits](netty/netty@netty-4.2.14.Final...netty-4.2.15.Final) Updates `io.netty:netty-handler` from 4.2.14.Final to 4.2.15.Final - [Release notes](https://github.com/netty/netty/releases) - [Commits](netty/netty@netty-4.2.14.Final...netty-4.2.15.Final) Updates `io.netty:netty-codec-http` from 4.2.14.Final to 4.2.15.Final - [Release notes](https://github.com/netty/netty/releases) - [Commits](netty/netty@netty-4.2.14.Final...netty-4.2.15.Final) --- updated-dependencies: - dependency-name: io.netty:netty-bom dependency-version: 4.2.15.Final dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.netty:netty-handler dependency-version: 4.2.15.Final dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: io.netty:netty-codec-http dependency-version: 4.2.15.Final dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps-dev): Bump vertx.version in /vertx/feign-vertx5-test Bumps `vertx.version` from 5.1.0 to 5.1.1. Updates `io.vertx:vertx-junit5` from 5.1.0 to 5.1.1 - [Commits](eclipse-vertx/vertx-junit5@5.1.0...5.1.1) Updates `io.vertx:vertx-web-client` from 5.1.0 to 5.1.1 - [Commits](vert-x3/vertx-web@5.1.0...5.1.1) --- updated-dependencies: - dependency-name: io.vertx:vertx-junit5 dependency-version: 5.1.1 dependency-type: direct:development update-type: version-update:semver-patch - dependency-name: io.vertx:vertx-web-client dependency-version: 5.1.1 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps-dev): Bump vertx.version in /vertx/feign-vertx4-test Bumps `vertx.version` from 4.5.27 to 4.5.28. Updates `io.vertx:vertx-junit5` from 4.5.27 to 4.5.28 - [Commits](eclipse-vertx/vertx-junit5@4.5.27...4.5.28) Updates `io.vertx:vertx-web-client` from 4.5.27 to 4.5.28 - [Commits](vert-x3/vertx-web@4.5.27...4.5.28) --- updated-dependencies: - dependency-name: io.vertx:vertx-junit5 dependency-version: 4.5.28 dependency-type: direct:development update-type: version-update:semver-patch - dependency-name: io.vertx:vertx-web-client dependency-version: 4.5.28 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): Bump kotlin.version from 2.3.21 to 2.4.0 Bumps `kotlin.version` from 2.3.21 to 2.4.0. Updates `org.jetbrains.kotlin:kotlin-stdlib-jdk8` from 2.3.21 to 2.4.0 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](JetBrains/kotlin@v2.3.21...v2.4.0) Updates `org.jetbrains.kotlin:kotlin-reflect` from 2.3.21 to 2.4.0 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](JetBrains/kotlin@v2.3.21...v2.4.0) Updates `org.jetbrains.kotlin:kotlin-maven-plugin` from 2.3.21 to 2.4.0 --- updated-dependencies: - dependency-name: org.jetbrains.kotlin:kotlin-stdlib-jdk8 dependency-version: 2.4.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.jetbrains.kotlin:kotlin-reflect dependency-version: 2.4.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.jetbrains.kotlin:kotlin-maven-plugin dependency-version: 2.4.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): Bump org.openrewrite.recipe:rewrite-migrate-java Bumps [org.openrewrite.recipe:rewrite-migrate-java](https://github.com/openrewrite/rewrite-migrate-java) from 3.35.0 to 3.36.0. - [Release notes](https://github.com/openrewrite/rewrite-migrate-java/releases) - [Commits](openrewrite/rewrite-migrate-java@v3.35.0...v3.36.0) --- updated-dependencies: - dependency-name: org.openrewrite.recipe:rewrite-migrate-java dependency-version: 3.36.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps-dev): Bump org.openrewrite.maven:rewrite-maven-plugin Bumps [org.openrewrite.maven:rewrite-maven-plugin](https://github.com/openrewrite/rewrite-maven-plugin) from 6.40.0 to 6.41.0. - [Release notes](https://github.com/openrewrite/rewrite-maven-plugin/releases) - [Commits](openrewrite/rewrite-maven-plugin@v6.40.0...v6.41.0) --- updated-dependencies: - dependency-name: org.openrewrite.maven:rewrite-maven-plugin dependency-version: 6.41.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): Bump org.openrewrite.recipe:rewrite-testing-frameworks Bumps [org.openrewrite.recipe:rewrite-testing-frameworks](https://github.com/openrewrite/rewrite-testing-frameworks) from 3.36.0 to 3.37.0. - [Release notes](https://github.com/openrewrite/rewrite-testing-frameworks/releases) - [Commits](openrewrite/rewrite-testing-frameworks@v3.36.0...v3.37.0) --- updated-dependencies: - dependency-name: org.openrewrite.recipe:rewrite-testing-frameworks dependency-version: 3.37.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * test: relocate Feign integration tests to feign-core and remove duplicated test fixtures Signed-off-by: Marvin Froeder <velo.br@gmail.com> * refactor: resolve feign defaults via a single memoized FeignDefaults service loader pass Signed-off-by: Marvin Froeder <velo.br@gmail.com> * test: keep assertj helpers in feign-core test-jar for downstream modules Signed-off-by: Marvin Froeder <velo.br@gmail.com> * build: regenerate feign-bom for 14.0-alpha1-SNAPSHOT with feign-api and feign-core Signed-off-by: Marvin Froeder <velo.br@gmail.com> * build: fix copyright symbol encoding in generated feign-bom license header Signed-off-by: Marvin Froeder <velo.br@gmail.com> * fix: update tests to use streaming Request.Body API after 14.x merge Signed-off-by: Marvin Froeder <velo.br@gmail.com> --------- Signed-off-by: Marvin Froeder <velo.br@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 8b0ce69 commit 1132e82

215 files changed

Lines changed: 1605 additions & 414 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

annotation-error-decoder/src/main/java/feign/error/AnnotationErrorDecoder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
import feign.Response;
2121
import feign.codec.Decoder;
22-
import feign.codec.DefaultDecoder;
23-
import feign.codec.DefaultErrorDecoder;
2422
import feign.codec.ErrorDecoder;
23+
import feign.core.codec.DefaultDecoder;
24+
import feign.core.codec.DefaultErrorDecoder;
2525
import java.lang.annotation.Annotation;
2626
import java.lang.reflect.AnnotatedElement;
2727
import java.lang.reflect.Method;

annotation-error-decoder/src/test/java/feign/error/AnnotationErrorDecoderExceptionConstructorsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
1919

20-
import feign.codec.DefaultDecoder;
20+
import feign.core.codec.DefaultDecoder;
2121
import feign.error.AnnotationErrorDecoderExceptionConstructorsTest.TestClientInterfaceWithDifferentExceptionConstructors;
2222
import feign.error.AnnotationErrorDecoderExceptionConstructorsTest.TestClientInterfaceWithDifferentExceptionConstructors.DeclaredDefaultConstructorException;
2323
import feign.error.AnnotationErrorDecoderExceptionConstructorsTest.TestClientInterfaceWithDifferentExceptionConstructors.DeclaredDefaultConstructorWithOtherConstructorsException;

api/pom.xml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Copyright © 2012 The Feign Authors (feign@commonhaus.dev)
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
-->
19+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20+
<modelVersion>4.0.0</modelVersion>
21+
22+
<parent>
23+
<groupId>io.github.openfeign</groupId>
24+
<artifactId>feign-parent</artifactId>
25+
<version>14.0-alpha1-SNAPSHOT</version>
26+
</parent>
27+
28+
<artifactId>feign-api</artifactId>
29+
<name>Feign API</name>
30+
<description>Feign API</description>
31+
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.junit.jupiter</groupId>
35+
<artifactId>junit-jupiter</artifactId>
36+
<scope>test</scope>
37+
</dependency>
38+
39+
<dependency>
40+
<groupId>org.mockito</groupId>
41+
<artifactId>mockito-core</artifactId>
42+
<version>${mockito.version}</version>
43+
<scope>test</scope>
44+
</dependency>
45+
46+
<dependency>
47+
<groupId>com.squareup.okhttp3</groupId>
48+
<artifactId>mockwebserver</artifactId>
49+
<scope>test</scope>
50+
</dependency>
51+
52+
<dependency>
53+
<groupId>com.google.code.gson</groupId>
54+
<artifactId>gson</artifactId>
55+
<scope>test</scope>
56+
</dependency>
57+
58+
<dependency>
59+
<groupId>org.springframework</groupId>
60+
<artifactId>spring-context</artifactId>
61+
<version>${spring-context.version}</version>
62+
<scope>test</scope>
63+
</dependency>
64+
65+
<dependency>
66+
<groupId>com.fasterxml.jackson.core</groupId>
67+
<artifactId>jackson-databind</artifactId>
68+
<scope>test</scope>
69+
</dependency>
70+
71+
<dependency>
72+
<groupId>com.google.auto.service</groupId>
73+
<artifactId>auto-service-annotations</artifactId>
74+
<version>${auto-service-annotations.version}</version>
75+
<scope>provided</scope>
76+
</dependency>
77+
</dependencies>
78+
79+
<build>
80+
<plugins>
81+
<plugin>
82+
<artifactId>maven-jar-plugin</artifactId>
83+
<executions>
84+
<execution>
85+
<goals>
86+
<goal>test-jar</goal>
87+
</goals>
88+
</execution>
89+
</executions>
90+
</plugin>
91+
<plugin>
92+
<groupId>org.apache.maven.plugins</groupId>
93+
<artifactId>maven-compiler-plugin</artifactId>
94+
<configuration>
95+
<annotationProcessorPaths>
96+
<path>
97+
<groupId>com.google.auto.service</groupId>
98+
<artifactId>auto-service</artifactId>
99+
<version>${auto-service-annotations.version}</version>
100+
</path>
101+
</annotationProcessorPaths>
102+
</configuration>
103+
</plugin>
104+
<plugin>
105+
<groupId>org.apache.maven.plugins</groupId>
106+
<artifactId>maven-enforcer-plugin</artifactId>
107+
<executions>
108+
<execution>
109+
<id>enforce-banned-dependencies</id>
110+
<goals>
111+
<goal>enforce</goal>
112+
</goals>
113+
<configuration>
114+
<rules>
115+
<bannedDependencies>
116+
<message>feign-api should never include any dependencies, this is a design choice to keep api light</message>
117+
<excludes>
118+
<exclude>*:*:*:*:*:*</exclude>
119+
</excludes>
120+
<includes>
121+
<include>*:*:*:*:test:*</include>
122+
<include>com.google.auto.service:auto-service-annotations</include>
123+
</includes>
124+
</bannedDependencies>
125+
</rules>
126+
<fail>true</fail>
127+
</configuration>
128+
</execution>
129+
</executions>
130+
</plugin>
131+
</plugins>
132+
</build>
133+
</project>

core/src/main/java/feign/AlwaysEncodeBodyContract.java renamed to api/src/main/java/feign/AlwaysEncodeBodyContract.java

File renamed without changes.
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import feign.Request.Options;
1919
import java.util.Optional;
2020
import java.util.concurrent.CompletableFuture;
21-
import java.util.concurrent.ExecutorService;
2221

2322
/** Submits HTTP {@link Request requests} asynchronously, with an optional context. */
2423
@Experimental
@@ -39,17 +38,6 @@ public interface AsyncClient<C> {
3938
*/
4039
CompletableFuture<Response> execute(Request request, Options options, Optional<C> requestContext);
4140

42-
/**
43-
* @deprecated use {@link DefaultAsyncClient} instead.
44-
*/
45-
@Deprecated
46-
class Default<C> extends DefaultAsyncClient<C> {
47-
48-
public Default(Client client, ExecutorService executorService) {
49-
super(client, executorService);
50-
}
51-
}
52-
5341
/**
5442
* A synchronous implementation of {@link AsyncClient}
5543
*
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static class AsyncBuilder<C> extends BaseBuilder<AsyncBuilder<C>, AsyncFe
7272
private AsyncContextSupplier<C> defaultContextSupplier = () -> null;
7373
private AsyncClient<C> client =
7474
new DefaultAsyncClient<>(
75-
new DefaultClient(null, null), LazyInitializedExecutorService.instance);
75+
ServiceLoaderUtils.defaults().client(), LazyInitializedExecutorService.instance);
7676
private MethodInfoResolver methodInfoResolver = MethodInfo::new;
7777

7878
@Deprecated
File renamed without changes.

core/src/main/java/feign/AsynchronousMethodHandler.java renamed to api/src/main/java/feign/AsynchronousMethodHandler.java

File renamed without changes.
Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818
import static feign.ExceptionPropagationPolicy.NONE;
1919

2020
import feign.Feign.ResponseMappingDecoder;
21-
import feign.Logger.NoOpLogger;
2221
import feign.Request.Options;
2322
import feign.codec.Codec;
2423
import feign.codec.Decoder;
25-
import feign.codec.DefaultDecoder;
26-
import feign.codec.DefaultEncoder;
27-
import feign.codec.DefaultErrorDecoder;
2824
import feign.codec.Encoder;
2925
import feign.codec.ErrorDecoder;
3026
import feign.interceptor.MethodInterceptor;
@@ -46,25 +42,33 @@ public abstract class BaseBuilder<B extends BaseBuilder<B, T>, T> implements Clo
4642
protected List<ResponseInterceptor> responseInterceptors = new ArrayList<>();
4743
protected List<MethodInterceptor> methodInterceptors = new ArrayList<>();
4844
protected Logger.Level logLevel = Logger.Level.NONE;
49-
protected Contract contract = new DefaultContract();
50-
protected Retryer retryer = new DefaultRetryer();
51-
protected Logger logger = new NoOpLogger();
52-
protected Encoder encoder = new DefaultEncoder();
53-
protected Decoder decoder = new DefaultDecoder();
45+
protected Contract contract;
46+
protected Retryer retryer;
47+
protected Logger logger;
48+
protected Encoder encoder;
49+
protected Decoder decoder;
5450
protected boolean closeAfterDecode = true;
5551
protected boolean decodeVoid = false;
56-
protected QueryMapEncoder queryMapEncoder = QueryMap.MapEncoder.FIELD.instance();
57-
protected ErrorDecoder errorDecoder = new DefaultErrorDecoder();
52+
protected QueryMapEncoder queryMapEncoder;
53+
protected ErrorDecoder errorDecoder;
5854
protected Options options = new Options();
59-
protected InvocationHandlerFactory invocationHandlerFactory =
60-
new DefaultInvocationHandlerFactory();
55+
protected InvocationHandlerFactory invocationHandlerFactory;
6156
protected boolean dismiss404;
6257
protected ExceptionPropagationPolicy propagationPolicy = NONE;
6358
protected List<Capability> capabilities = new ArrayList<>();
6459

6560
public BaseBuilder() {
6661
super();
6762
thisB = (B) this;
63+
FeignDefaults defaults = ServiceLoaderUtils.defaults();
64+
this.contract = defaults.contract();
65+
this.retryer = defaults.retryer();
66+
this.logger = defaults.logger();
67+
this.encoder = defaults.encoder();
68+
this.decoder = defaults.decoder();
69+
this.queryMapEncoder = defaults.queryMapEncoder();
70+
this.errorDecoder = defaults.errorDecoder();
71+
this.invocationHandlerFactory = defaults.invocationHandlerFactory();
6872
}
6973

7074
public B logLevel(Logger.Level logLevel) {

0 commit comments

Comments
 (0)