Questions tagged [spring-rest]
Use this tag for question about the REST architectural style used in Spring framework
spring-rest
1,309
questions
0
votes
2
answers
69
views
How can I enforce naming conventions on spring rest controllers?
For our REST API we have standardized on using hyphen case,
i.e. GET /store-users?first-name=dan and not GET /storeUsers?firstName=dan
How can we enforce this naming convention as developers keep ...
1
vote
3
answers
86
views
Unable to mock a RestClient bean when testing a class that uses this bean
So I have two classes : A RestClient class and another MetadataService class which uses the restClient bean.
This is the RestClient class
@Configuration
public class RestClientConfig {
//actual ...
0
votes
0
answers
64
views
OpenAPI Schema with Springdoc mixing schemas from file with Controller generation
I'am using Springdoc (2.5.0) with Spring Boot 3.3. I'm trying to generate an OpenAPI Spec from MyRestController, which looks like this:
public class MyRestController {
@GetMapping("/&...
0
votes
0
answers
137
views
SpringBoot 3.3 RestClient with Proxy and Authenication gives 401 response
Initializing proxy and basic authentication throws 401 unauthorized error and check the logs for the below code gives No credentials for basic schema DEBUG log is seen
proxyUrl = "proxy.ops.org&...
0
votes
0
answers
17
views
How test @NotNull on a controller?
I have this controller :
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
@...
0
votes
1
answer
28
views
Is it a good practice to call rest controller function in another rest controller function of the same controller based on request type?
Let's assume, I have 2 REST Endpoints and the second of them calls internally first one. The POST endpoint will behave like normal GET endpoint, but because of very large Set of dependentCategories, I ...
0
votes
1
answer
51
views
Graphql requests not served by graphql but by general spring rest
My spring boot application exposes both rest and graphql endpoints for different set of apis. Rest endpoints are working fine but graphql requests are also considered as rest and throwing 404 as it ...
0
votes
0
answers
39
views
Encoding a URL with : and / in their queries
Im trying to write a spring app for reporting to use XCP/Xen servers rest api and hitting a bit of an issue with the URI's and how they pass through their search/tags
to filter you need to pass ...
-1
votes
1
answer
37
views
spring REST API Pageable returns empty object
I know, this has been asked before.
But I did check a bunch of those answers and could not find anything with the same context that solved the issue.
The code is very straight forward:
@GetMapping(&...
1
vote
2
answers
88
views
How to make pause between each api call in springframework RestClient
This is a org.springframework.web.client.RestClient config
@Configuration
public class CloudConfig {
@Value("${experimental.host}")
String baseURI;
@Bean
RestClient ...
0
votes
1
answer
340
views
Spring Boot: Full CRUD REST endpoints are auto-generated and shown in SwaggerUI
I’ve created a spring-boot project and defined a REST controller with 1 endpoint for /employers
@RestController
public class EmployerController {
@Autowired
private EmployerService ...
0
votes
0
answers
67
views
How to extract response body as String/Object from RestClient in case of exception?
Now I have it like this:
protected static ResponseEntity<?> actualResponse;
protected static RestClientResponseException actualErrorResponse;
try{
actualResponse = REST_CLIENT.get()
...
0
votes
0
answers
30
views
Problem in viewing videos in Thymeleaf & Spring
I run many services using docker-compose, I have a service which is responsible for reading and writing video. it write the video in the same project under videos directory.
The problem is when the ...
0
votes
1
answer
90
views
How to prevent nesting of json objects in API
I have a spring boot application with frontend and backend connected using apache HttpClient.
There are many bi-directional associations between the entities. For example:
@NamedEntityGraphs(
{...
-1
votes
1
answer
159
views
getting "NULL" instead of null in Json response in java
I have my own object when there is no value it is coming as "NULL" in a string from downstream and it is failing while converting to java object in ObjectMapper
class Test
private String ...