Questions tagged [resttemplate]
Use this tag for Spring's RestTemplate, a class for client-side HTTP communications and RESTful principles enforcement.
resttemplate
2,862
questions
-5
votes
0
answers
55
views
Why is the `userId` field null in myBody [closed]
I'm working on a Spring Boot application where I'm trying to fetch user ratings and their associated hotel details. The data is being fetched from two different microservices using RestTemplate. ...
0
votes
1
answer
32
views
Mockito and Spring RestTemplate issue
I want to test this class :
public class TokenIntrospector {
private RestTemplate restTemplate;
private String userInfoUri = "http://localhost";
public TokenIntrospector(...
0
votes
0
answers
36
views
Issues with Cross-Namespace Service Discovery in Kubernetes with Spring cloud kubernetes
I'm running multiple Spring Boot applications in two different Kubernetes namespaces. Here’s my configuration for all services:
SPRING_CLOUD_KUBERNETES_DISCOVERY_NAMESPACES_0: welcoming
...
0
votes
1
answer
24
views
WebClient request not working after converting from Rest Template
I'm having an issue converting this piece of code below to WebClient. I'm planning to convert it to WebClient as recommended by this doc https://www.baeldung.com/rest-template and I think it is more ...
0
votes
0
answers
21
views
How to make a mock RestTemplate persist even when it's being assigned in the method of the actual class
I got a problem might not be possible to resolve but I still want to see if anyone has any suggestion.
Please see the MyService and MyServiceTest Java classes below.
I tried to make the restTemplate ...
0
votes
0
answers
30
views
Invalid mime type "zip": does not contain '/'
Here is the docs link for downloading artifact from Github Workflow
I have following code:
public class Main {
public static void main(String... args) throws IOException {
String token = &...
0
votes
1
answer
50
views
Problem unmarshalling a json array in spring boot
I'm trying to unmarshall the json array from https://pokeapi.co/api/v2/pokemon/25/encounters, here it's the resume version:
[
{
"location_area": {
"name": "sinnoh-...
0
votes
0
answers
31
views
I have to call delete API from another service, which rest template method i can use
I have to call a delete API from another service which required a CartRequestDTO to perform the operation. Which REST template method can I use to send the CartRequestDTO to call the service.
private ...
0
votes
1
answer
58
views
Parameteryzed HttpEntity in ArgumentMatcher is not working
I'm making some tests using Mockito and my test are running succesfuly with a wrong parameter in the HttpEntity's generic.
@UnitTest
@RunWith(MockitoJUnitRunner.class)
public class ...
-1
votes
1
answer
92
views
Upgrading Spring Boot from 2.7.14 to 3.2.4 giving 415 Unsupported Media Type
I have updated the Spring boot version from 2.7.14 to 3.2.4 in existing application. Rest everything remains same, but it is giving 415 unsupported media type.
I have spend days on this, but do not ...
0
votes
0
answers
16
views
Getting null when i try to mock restTemplate.GetForObject - kotlin
I have a service function something akin to this:
class serviceClass
private fun getThings(personID: Long): List<myDTO> {
val url = UriComponentsBuilder
.fromHttpUrl("...
0
votes
1
answer
28
views
Custom proxy creation with spring boot - Headers and RequestParam issues
As instructed by my boss, I'm trying to create a proxy that receives a URL and a request (method, header, body) and correctly routes the request to the endpoint provided and returns the response. ...
0
votes
0
answers
19
views
RestTemplate- How to decide maxConnection and maxConnectionPerRoute?
In RestTemplate how do we decide what should be maxConnection and maxConnectionPerRoute value?
In some examples i see maxConnection = 100 and maxConnectionPerRoute = 20 and other value. Why can't i ...
0
votes
0
answers
24
views
What does "UnsatisfiedDependency Error creating bean" in Spring Rest mean?
I'm developing a microservice about trainers and their messages in Spring using Rest. I have the controllers and services created (with their corresponding http request implementations created), and ...
1
vote
1
answer
120
views
how to send GET request with Query param using Rest Template in java
i need to send GET request with query param: query=100 - (avg(rate(node_cpu_seconds_total{job="prometheus",mode="idle"}[1m])) * 100)
with RestTemplate
this is a PromQL query for ...