Questions tagged [spring-web]

The Spring Web model-view-controller (MVC) framework.

The Spring Web model-view-controller (MVC) framework is designed around a DispatcherServlet that dispatches requests to handlers, with configurable handler mappings, view resolution, locale, time zone and theme resolution as well as support for uploading files. The default handler is based on the @Controller and @RequestMapping annotations, offering a wide range of flexible handling methods. With the introduction of Spring 3.0, the @Controller mechanism also allows you to create RESTful Web sites and applications, through the @PathVariable annotation and other features.

Official Documentation

386 questions
3
votes
1 answer

Redshift jdbc connection configuration with Spring boot 2 not working

Here are my dependencies in build.gradle. compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.2.RELEASE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version:…
3
votes
0 answers

RestTemplate HTTS & Choosing the Client Certificate

Can someone help me understand how to use HTTPS mutual authentication such that I can programmatically choose which client certificate to use during authentication? Here is the context of the question. I am using: A JKS containing multiple client…
3
votes
1 answer

Disable transfer-encoding: chunked in Spring Webflux responses

I created bunch of REST API end points using Spring Webflux reactive libraries. The issue I am facing now is that the responses that spring Webflux returns have transfer-encoding: chunked HTTP header. Because of which client side application using…
ROCKY
  • 1,763
  • 1
  • 21
  • 25
3
votes
0 answers

Spring Boot Starter Web - Pagination & Sorting

I have created a project using spring-boot-starter-web. Additionally I have created a RESt controller like this: @RestController public class DaaController { @RequestMapping("/api/v1/data") public List getData(@RequestParam(value =…
JDC
  • 4,247
  • 5
  • 31
  • 74
3
votes
2 answers

Rest endpoint mapped with @PathVariables separated by comma

I have @RestController with @RequestMapping("/api/my-resource"). I have @GetMapping for extracting certain entity. @GetMapping(value = "/{firstId},{secondId}") public ResponseEntity findMyResource( @PathVariable…
xenteros
  • 15,586
  • 12
  • 56
  • 91
3
votes
0 answers

Spring RestTemplateBuilder does not add MessageConverters

I created this restTemplate bean.. @Bean public RestTemplate restTemplate(RestTemplateBuilder builder) { return builder .messageConverters(Collections.singletonList(new MappingJackson2HttpMessageConverter())) …
tuty_fruity
  • 523
  • 1
  • 5
  • 18
3
votes
1 answer

Spring dynamic HttpStatus from a variable

I have an application where I am returning dynamic HttpStatus code from my controller by using ResponseEntity return new ResponseEntity("Unrecognised request.", HttpStatus.BAD_REQUEST); The next requirement is that the response body and the…
BiJ
  • 1,639
  • 5
  • 24
  • 55
3
votes
1 answer

Why AsyncRestTemplate in a spring doesn't has Interceptors like RestTemplate?

I have one situation where I need to intercept the request and I need to set authorization header into that request. So I got the solution that I can use interceptors to set that header but when I check AsyncRestTemplate then It doesn't have that…
NIrav Modi
  • 6,038
  • 8
  • 32
  • 47
3
votes
2 answers

Spring's AsyncRestTemplate not working with zipped content, Getting compressed content instead of json object

I have enabled content compression on my spring boot app and response of every API is getting compressed but if I hit those APIS using RestTemplate I get content like…
Naresh Joshi
  • 4,188
  • 35
  • 45
3
votes
2 answers

Spring Boot ExceptionHandler Throwing More Errors

I'm using Spring Boot configured via annotations and I ran into an issue where the exception handler would throw errors that I couldn't catch. I figured out how to stop the error from being thrown but I have no idea why it…
ArmedChef
  • 106
  • 10
3
votes
4 answers

How to call a @RestController with @RequestBody?

I have a simple servlet as follows: @RestController public class TestServlet { @RequestMapping(value = "/test1") public String test1() { return "test1"; } @RequestMapping(value = "/test2") public String…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
3
votes
2 answers

Is a Java EE server required when project is made with Spring web?

I started developing a rest service with JavaEE + Glassfish and I noticed Glassfish is no longer in a good position in terms of development from Oracle. I ran into a few bugs that were not being fixed for months despite many reports from users. I…
Arya
  • 8,473
  • 27
  • 105
  • 175
3
votes
1 answer

No adapter for handler ... The DispatcherServlet configuration needs to include a HandlerAdapter that supports this handler

Tired of using XML files for Spring config, tried moving into a full Java approach, but I'm doubtlessly failing at it. Just 2 classes involved: @Configuration public class AppInitializer implements WebApplicationInitializer { @Override …
gvasquez
  • 1,919
  • 5
  • 27
  • 41
3
votes
2 answers

Spring web app returns HTTP Status 406

I'm creating a basic spring based web app: pom dependencies: 1.8 4.3.3.RELEASE 2.8.3
forhas
  • 11,551
  • 21
  • 77
  • 111
3
votes
0 answers

Expected single matching bean but found 2: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping

Before asking the question here, I have tried this and this. This is the error I am facing. expected single matching bean but found 2: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping The problem started only after…