Environment
Spring boot version: 2.4.1
implementation 'org.springframework.boot:spring-boot-starter-webflux'
Problem is
I changed MediaType as [application_json] using accept setter but webClient throw WebclientReponseException.
public Member getMember(String id) {
Member member = webClient
.mutate()
.build()
.get()
.uri("/v1/api/member/id?id={id}", id)
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(Member.class)
.flux()
.toStream()
.findFirst()
.orElse(null);
return member;
}
org.springframework.web.reactive.function.client.WebClientResponseException: 200 OK from GET http://localhost:9090/v1/api/member/id?id=test; nested exception is org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'text/html;charset=UTF-8' not supported for bodyType=com.masterpiece.core.model.Member
Weired thing is
"The problem depends on uri structure."
/v1/api/member/id <- problem (throw UnsupportedMediaTypeException) /api/v1/member/id <- working properly
Comment From: coolshow9
This is my mistake. The Problem was Spring Security url permission.
Thanks!
Comment From: kvasim
This is my mistake. The Problem was Spring Security url permission.
Thanks!
what did you add for fix? plz share.
Comment From: Vishnu-mv
This is my mistake. The Problem was Spring Security url permission.
Thanks!
@kvasim , please share how you fixed it.