spring-restcontroller Questions

1

My use case: On user request create tmp file (I don't really need to create real file, but I need to have java.io.File instance) Process this file Return file and other meta data as json Remove ...
Criss asked 24/11, 2017 at 17:14

2

With WebClient I use this code to make web client work with a Spring Resource Server endpoint. Is it possible to make this code work with the new RestClient? @Bean UserClient userClient(OAuth2Autho...

18

Solved

I have created a simple REST service (POST). But when i call this service from postman @RequestBody is not receiving any values. import org.springframework.http.MediaType; import org.springframewo...
Inconsequential asked 13/8, 2016 at 18:49

4

What does the parameter in @RestController("/path/..") do? Does it not set the base path like @RequestMapping("/path/.."). What is the difference? @RestController("base-path")
Seward asked 20/2, 2018 at 17:33

4

Solved

In my spring boot service, I'm using https://github.com/java-json-tools/json-patch for handling PATCH requests. Everything seems to be ok except a way to avoid modifying immutable fields like obje...

10

Solved

I want to add an upload function to my spring boot application; this is my upload Rest Controller package org.sid.web; import java.io.BufferedOutputStream; import java.io.File; import java.io.F...
Delve asked 12/5, 2017 at 11:9

2

Is there a way to map properties of Sort objects? Just a little example: a Dto public class OrderDto { private long totalAmount; private long openAmount; } and an entity @Entity public class Ord...
Enforcement asked 6/7, 2021 at 12:44

7

I got the following @RestController inside a spring boot application : @Data @RestController public class Hello { @Autowired private ResturantExpensesRepo repo; @RequestMapping(value = "/...

5

Solved

We are creating rest api's with Spring Boot. We have three layers in our project(Repository, Service and Controller). Lets say I have GetUser api in my controller that return UserDTO object. @Get...
Sauls asked 14/12, 2017 at 22:17

5

Solved

In order to have unified exception handling throughout the application I am using Error Handling for REST with Spring solution#3 which uses @ControllerAdvice along with @ExceptionHandler. Spring v...

2

I spent a few hours today on a migration issue to Spring security 6.0 by replacing the deprecated authorizeRequests() method with authorizeHttpRequests(). I learned that under the hood, this implie...

4

Solved

I want to handle json to Object conversion differently on different @RequestMapping in my Controller. I believe if we add Jackson dependency in our spring-boot project it handles json to Object c...
Misanthrope asked 8/10, 2019 at 17:24

7

I have a sample spring rest mvc application which has the following java code: SampleController.java import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Au...
Monto asked 24/11, 2015 at 7:22

7

Solved

I am trying to deploy a Spring-Boot application with Service accessing a JpaRepository which is connecting to PostgreSQL DB at runtime using JPA and Hibernate, refering to connection properties in ...

2

Solved

I can't fetch JSONObject directly, this code works: RestTemplate restTemplate = new RestTemplate(); String str = restTemplate.getForObject("http://127.0.0.1:8888/books", String.class); JSONObject ...
Inweave asked 25/1, 2017 at 11:1

4

I want to return a simple plain text string as follows: @RestController @RequestMapping("/test") public class TestController { @ResponseStatus(HttpStatus.OK) @RequestMapping(value = "/my", meth...
Psychosexual asked 29/10, 2015 at 13:2

1

Situation: I have a non-reactive legacy library which expects an OutputStream and writes its output into it, the method signature is something like void produceData(OutputStream stream) I want to ...

11

Solved

I am trying to implement simple demo MVC app with Spring Boot but I get 404 error while executing the application. The uri is http://localhost:8080/ which is to display all the rows in a table call...

2

Solved

I created an integration test for asynchronous rest controller method. Which looks like: @Test public void shouldHandleRequestsAsynchronously() throws Exception { MvcResult mvcResult = this.moc...
Presentational asked 31/3, 2018 at 22:26

2

Solved

I have a spring REST controller which returns the following JSON payload: [ { "id": 5920, "title": "a title" }, { "id": 5926, "title": "another title", } ] The REST controller with its c...
Icsh asked 29/10, 2016 at 20:18

12

Solved

I am trying to send POST request to my controller but cannot pass any parameter in any type unless I decide to use JSON. My goal is to pass a String and a file to my controller but I keep getting R...
Tequilater asked 4/10, 2017 at 10:59

2

everyone. I use strategy "Design first". I describe specification. One of the methods accepts HttpServletResponse as paramether. But i don't know ho to describe it correctly in my .yaml-f...

4

Solved

I've been going through my head the best way to design a JSON API using Spring MVC. As we all know IO is expensive, and thus I don't want to make the client make several API calls to get what they ...
Scribner asked 31/5, 2015 at 14:49

7

I am using Spring Boot and I can send images that are smaller than 1MB, but when I make a post request with a large image larger than 1MB I get this error: Maximum upload size exceeded; nested exc...
Toshiatoshiko asked 18/7, 2018 at 20:31

6

Solved

I have some Spring RESTful (RestControllers) web services with no web.xml and I am using Spring boot to start the services. I want to add authorization layer for the web services and wanted to ro...
Pierre asked 13/7, 2016 at 19:31

© 2022 - 2025 — McMap. All rights reserved.