spring-web Questions
2
In my spring boot application I have the following controller
@RestController(value = "ProjectController")
@CrossOrigin(origins = {"${app.api.settings.cross-origin.urls}"})
public class ProjectCon...
Decompress asked 11/3, 2018 at 15:19
12
Solved
For my Spring-Boot app I provide a RestTemplate though a @Configuration file so I can add sensible defaults(ex Timeouts). For my integration tests I would like to mock the RestTemplate as I dont wa...
Rossanarosse asked 2/3, 2016 at 9:18
8
Solved
Coming from a Node background, what is the equivalent of console.log() in spring boot?
For example I'd like to see in my console the job info in the following method.
@RequestMapping(value = "job...
Shelbashelbi asked 17/2, 2018 at 18:48
3
Solved
I setup my Spring Security application according to the reference document and after hours of troubleshooting I continue to get a null @AuthenticationPrincipal passed into my controller.
The auth...
Rondelet asked 21/9, 2015 at 2:45
6
So I have this code
import org.springframework.web.bind.annotation.GetMapping;
And I already have the following in my POM file
<packaging>war</packaging>
<properties>
<sp...
Singlefoot asked 7/9, 2017 at 4:30
2
A construct that I often use in my code is the following:
@RestController
public class HelloController {
@Autowired
private HelloService helloService;
@GetMapping("/hello")
ResponseEntity<...
Dithionite asked 6/7, 2018 at 10:13
4
Solved
I am getting error while sending the Lazy loaded object as a JSON in response to REST request in spring boot.
When I request from browser to fetch the parentTree and call get method to get the ver...
Heid asked 1/5, 2019 at 20:31
2
Solved
I wanted to analyze the improvement I may see by enabling Async Controllers in Spring Boot over normal controller
So here is my test code. One API returns a Callable and another is normal controll...
Semiautomatic asked 18/6, 2016 at 14:25
2
Solved
Given a test class like:
@WebMvcTest
@RunWith(SpringRunner.class)
@SpringBootTest(properties = "spring.profiles.active=test")
public class MyControllerTest {
... some tests
}
I get the error:
...
Shank asked 16/10, 2018 at 22:22
2
Solved
I have RestController annotated with @Validated for validating path variables / request parmas:
@RestController
@Validated
public class MainController implements ApplicationListener<Application...
Canonize asked 13/3, 2019 at 7:54
2
Basically, I want to log a request/response informations in one log containing bodies/headers with a Spring WebClient.
With Spring RestTemplate we can do it with a ClientHttpRequestInterceptor. I ...
Ignoble asked 15/5, 2019 at 8:35
4
I'm new to Spring and trying to do a rest request with RestTemplate. The Java code should do the same as below curl command:
curl --data "name=feature&color=#5843AD" --header "PRIVATE-TOKEN: x...
Woodwork asked 6/3, 2018 at 9:18
4
I have a simple webservice that returns content either as json or as plain text (depending on the clients' accept http header).
Problem: if an error occurs during text/plain request, Spring someho...
Sunnysunproof asked 30/7, 2018 at 12:33
7
Solved
An Abstract controller class requires List of objects from REST. While using Spring RestTemplate its not mapping it to required class instead it returns Linked HashMAp
public List<T> ...
Jamal asked 28/4, 2016 at 13:15
8
Solved
I have this enum :
public enum SortEnum {
asc, desc;
}
That I want to use as a parameter of a rest request :
@RequestMapping(value = "/events", method = RequestMethod.GET, produces = MediaType...
Ikon asked 29/9, 2016 at 15:30
1
I have a Spring webapp that uses HttpInvoker to connect to a Spring Boot service.
I have recently updated the service project to use Java 11 and at the same time updated it to Spring Boot starter 2...
Stringent asked 13/3, 2019 at 4:25
5
Solved
I have this controller method:
@PostMapping(
value = "/createleave",
params = {"start","end","hours","username"})
public void createLeave(@RequestParam(value = "start") String start,
@RequestPa...
Ravenravening asked 23/11, 2017 at 14:6
2
How can I tell spring-web to validate my dto without having to use getter/setter?
@PostMapping(path = "/test")
public void test(@Valid @RequestBody WebDTO dto) {
}
public class WebDTO {
@Valid ...
Extend asked 10/1, 2019 at 11:50
2
I'm looking to define /api as the root context for all my @RestControllers and don't want to specify it for each of them.
For instance, I would like to write @RestController("/clients") instead of...
Twoway asked 13/11, 2017 at 13:13
2
I'm having a @RestController webservice method that might block the response thread with a long running service call. As follows:
@RestController
public class MyRestController {
//could be anothe...
Shu asked 9/5, 2019 at 8:23
2
Solved
I'm creating a Spring-Boot microservice REST API that expects @RequestParam of type List<String>. How can I validate that the list contains a minimum and a maximum amount of values?
So far I...
Decarburize asked 27/3, 2019 at 7:50
1
Solved
I am using spring-webflux and want to upload files .... everything works great with just spring-web but when it comes to webflux i have not a clue what's wrong .
Be careful in the difference ... i...
Foliole asked 11/4, 2019 at 12:33
2
Solved
I have a service which uses springs RestTemplate to call out to multiple urls.
To improve performance I'd like to perform these requests in parallel. Two options available to me are:
java 8 para...
Hip asked 11/2, 2019 at 21:37
1
Solved
I am looking for a quick/easy solution how to automatically serialize Rest controllers output to CSV instead of JSON. I have the simplest possible Spring boot application:
@SpringBootApplication
p...
Osterhus asked 6/11, 2018 at 14:36
1
How can I change the error attributes that are exposed when throwing a ResponseStatusException?
Especially I want to hide the exception, error and status type in the json, but only during producti...
Bumblebee asked 6/11, 2018 at 12:22
1 Next >
© 2022 - 2024 — McMap. All rights reserved.