OpenFeign doesn't work with kotlin suspend method
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- java, kotlin, spring-boot
Hướng nghiên cứu
Bắt đầu tại SpringMvcContract.parseAndValidateMetadata và Feign Contract.BaseContract.parseAndValidateMetadata, sử dụng interface suspend được báo cáo làm trường hợp tái hiện. Theo dõi cách tham số kotlin.coroutines.Continuation được tạo ra được phân loại, sau đó xác minh rằng việc tạo Feign client thành công mà không gặp ngoại lệ “too many Body parameters”.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have an API interface where the methods are kotlin suspend methods:
@FeignClient(path = "/api/masker", contextId = "MaskerApi", name = Const.SERVICE, configuration = [FeignConfig::class])
interface MaskerApi {
@PostMapping("/mask")
suspend fun mask(
@Valid @RequestBody maskRequest: MaskRequest,
): RestResponse<List<CharSequence>>
@PostMapping("/matches")
suspend fun matches(
@Valid @RequestBody maskRequest: MaskRequest,
): RestResponse<List<Boolean>>
}
But when I run the program, the program throws an exception:
Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract java.lang.Object io.github.xhstormr.masker.web.api.masker.MaskerApi.matches(io.github.xhstormr.masker.model.masker.MaskRequest,kotlin.coroutines.Continuation)
Warnings:
-
at feign.Util.checkState(Util.java:121) ~[feign-core-11.7.jar:na]
at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:142) ~[feign-core-11.7.jar:na]
at org.springframework.cloud.openfeign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:193) ~[spring-cloud-openfeign-core-3.1.0.jar:3.1.0]
at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:65) ~[feign-core-11.7.jar:na]
at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:151) ~[feign-core-11.7.jar:na]
at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:49) ~[feign-core-11.7.jar:na]
at feign.Feign$Builder.target(Feign.java:268) ~[feign-core-11.7.jar:na]
at org.springframework.cloud.openfeign.DefaultTargeter.target(DefaultTargeter.java:30) ~[spring-cloud-openfeign-core-3.1.0.jar:3.1.0]
at org.springframework.cloud.openfeign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:373) ~[spring-cloud-openfeign-core-3.1.0.jar:3.1.0]
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getTarget(FeignClientFactoryBean.java:421) ~[spring-cloud-openfeign-core-3.1.0.jar:3.1.0]
at org.springframework.cloud.openfeign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:396) ~[spring-cloud-openfeign-core-3.1.0.jar:3.1.0]
at org.springframework.cloud.openfeign.FeignClientsRegistrar.lambda$registerFeignClient$0(FeignClientsRegistrar.java:235) ~[spring-cloud-openfeign-core-3.1.0.jar:3.1.0]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1249) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1191) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.14.jar:5.3.14]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.14.jar:5.3.14]
... 28 common frames omitted
This kotlin.coroutines.Continuation parameter is generated by the kotlin compiler at compile time, so I can't modify this parameter, how can I tell FeignClient to ignore this Continuation parameter?
- Ngôn ngữ chính
- Java
- Star
- 1.3k
- Fork
- 835
- Merge trung bình
- 23 giờ 57 phút
- Pull request đã merge (30 ngày)
- 25
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của spring-cloud/spring-cloud-openfeign
-
question
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
spring-cloud/spring-cloud-openfeign#1392 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
FeignClientsConfiguration$MicrometerConfiguration.class cannot be opened because it does not existĐang mởfeedback-provided
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
spring-cloud/spring-cloud-openfeign#1379 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
waiting-for-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
spring-cloud/spring-cloud-openfeign#1344 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
waiting-for-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
spring-cloud/spring-cloud-openfeign#1343 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
waiting-for-triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
spring-cloud/spring-cloud-openfeign#1340 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của spring-cloud/spring-cloud-openfeign
Issue tương tự
-
agent:working bug follow-up lane:auto
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Sanne/incus-spawn#1765 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
checkstyle/checkstyle#22260 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
strimzi/strimzi-kafka-operator#13328 · 1 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày