215 questions
0
votes
0
answers
139
views
Checkmarx issue(SSRF) on queryparam String
Our controller looks like this:
public ResponseEntity<ServiceResponse<List<String>>> getItemIdentifiers(
@RequestParam(required = true) String category_,
@...
1
vote
0
answers
532
views
How to Resolve servletRequest cannot be null error for OAuth2 RestTemplate Interceptor in Spring Batch?
I'm trying to replace the deprecated OAuth2RestTemplate with a custom interceptor approach for adding an x-access-token header using the ClientHttpRequestInterceptor in Spring Batch. My goal is to ...
1
vote
1
answer
403
views
Cant get TestRestTemplate to not follow redirects
I want to test some endpint that return a redirect (302).
I want to use TestRestTemplate to test it but I cant get it to not automatically follow the redirect. I just want to get the response not make ...
2
votes
0
answers
496
views
Migrating RestTemplate code to RestClient code in Spring Boot app
I want to use the Spring Boot's RestClient feature for my application.
So, I want to migrate the existing Spring Boot's RestTemplate code to Spring Boot's RestClient code.
I have a code that works ...
1
vote
2
answers
197
views
Rest Template Returns Response in Garbled Characters Some Sort of Chinese
I am using rest template to call API, when I hit the API using rest template it returns some garbled characters like Chinese.
ResponseEntity<String> response = restTemplate.exchange(url, method, ...
-1
votes
1
answer
31
views
spring resttemplate call throwing unauthorized error
i need to call service admin app to app with http. both the services is listening on port
c053b74b7e3a app-pre_prod:latest "java -jar -Dspring.…" 0.0.0.0:8080->8080/tcp, :::8080-&...
1
vote
0
answers
213
views
How to handle HTTP 429 in Spring Boot AI App?
I am trying to develop a application using spring Gen AI.
Endpoint returns a Http 429 error code
Error response: I ran into this error below
retrofit2.adapter.rxjava2.HttpException: HTTP 429
at ...
0
votes
1
answer
536
views
How to get the response of an API call using Rest Template when the response type is unknown
I have a requirement where I need to fetch the response of various company results. Each company will share a REST API with me (with all the details to invoke the API). I need to read a particular ...
0
votes
2
answers
299
views
I work with Spring Boot and REST template. I want to get the information of user connect
I work with Spring Boot and REST template. I want to get the information of user connect but I get the information just if I connect with admin account and not the author account. This is my code
...
1
vote
0
answers
2k
views
Parameter specified as non-null is null: method okhttp3.Request$Builder.addHeader after Spring Boot 3.x
After Spring Boot 3.x version, an error is received when passing a null header to Resttemplate. Is there any way to overcome this situation?
Error:
java.lang.NullPointerException: Parameter specified ...
1
vote
0
answers
355
views
SpringBoot RestClient TraceId
I switched from RestTemplate to RestClient in my application and since switching I’m unable to get the same TraceId between services. Is anyone else having this same problem?
I tried updating ...
-1
votes
1
answer
177
views
404 Bad Request error Spring Boot for Open Api
@Service
public class AirService {
@Value("${api.key}")
private String apiKey;
@Value("${api.url}")
private String apiUrl;
@Autowired
private ...
0
votes
0
answers
104
views
Not able to use mocked restTemplate twice
I am not able to use mocked restTemplate twice when calling an api with two different request bodies to have two corresponding responses, it’s giving suggestion like check the arguments for mocked ...
-1
votes
1
answer
165
views
How to mock the RestTemplate getForObject
I am not able to mock below piece of restTemplate getForObject , Its giving assertion errors when i run my test case , can some one help me how to mock?.
ServiceClient.class
String localizationDetails ...
1
vote
1
answer
710
views
Connection reset when making a rest call with RestTemplate
I'm using
/* Apache HttpComponents */
val apacheHttpComponentsVersion = "5.2.1"
val apacheHttpComponentsGroup = "org.apache.httpcomponents.client5"
implementation(&...
1
vote
0
answers
313
views
Handling OOM issue while sending 1GB Binary file using Spring RestTemplate
In my application we are reading more than 1 million rows from DB. Storing this data in Csv file in streaming manner by using Jdbc ResultSet. OpenCsv library is used to create CSV file which is zipped ...
1
vote
2
answers
3k
views
micrometer - spring boot 3 - rest template - traceids are not propagated as expected
I have two spring boot services A and B.
Service A uses a RestTemplate to call an endpoint in Service B.
RestTemplate and the call in Service A looks like below:
@Bean
public RestTemplate ...
1
vote
0
answers
60
views
How do I enter the id manually, even though it is GenerationType.IDENTITY
I want to enter a manual id so I can test, but even if I enter 7 it creates the id
I want my entity to be auto incrementing, but if I enter the value manually I get the manual value, but even if I ...
1
vote
1
answer
970
views
How to return ResponseEntity when mocking RestTemplate
following is my method which I am trying to unit test
public class Emp {
public String getName() {
ResponseEntity<LinkedHashMap> res = restTemplate.postForEntity(url, null, LinkedHashMap....
0
votes
1
answer
316
views
REST: openapi generation - response needs XML/JSON conversion while request is XML String
I'm building a client for an API where endpoint accepts XML for request (application/xml) and provides XML/JSON back in response (applicaiton/json, application/xml)
At the moment of calling the API I ...
0
votes
1
answer
267
views
Java Spring RestTemplate getForObject response not decoded properly
I am trying to execute a HTTP GET request that I can execute properly in Postman in my Spring Boot application using the RestTemplate class.
This is the code I am using to send the request:
...
0
votes
1
answer
6k
views
Cannot invoke"org.springframework.web.client.RestTemplate.getForEntity(String, java.lang.Class, Object[])""this.restTemplate"null [duplicate]
i'm working on an tokenValidationInterceptor , where a request for token validation is send to an other micro-service which communicate with keycloak and send an ok status or unautorazed status , then ...
1
vote
2
answers
2k
views
How to call https url using spring boot 3
I try to configure restTemplate to call https url in spring boot 3 but that does not compile. For this i use import org.apache.http.impl.client.HttpClients import org.apache.http.ssl.SSLContexts and ...
0
votes
0
answers
4k
views
Getting RestTemplate (Connection Reset) Despite everything is correct
I'm using Spring Boot RestTemplate to call REST API.
On PROD, I'm getting below exception:
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://<host&...
2
votes
1
answer
2k
views
How to implement test to check that actuator metrics are exist ? 404 for /actuator/prometheus in tests
I have a spring boot appication(version is 3.0.4):
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
&...