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
5
votes
0 answers

Spring 4.2: CacheControl doesn't allow no-store and no-cache header

We are migrating a project from spring-web 4.1.8 to 4.2.3 and need to replace the deprecated code WebContentInterceptor interceptor = new…
NOTtardy
  • 154
  • 6
5
votes
2 answers

org.springframework.boot.SpringApplication can not be resolved

I am trying to Run a web-service server as standalone application using the spring-boot (1.2.4.RELEASE). I have refereed the tutorial provided here spring site. But in my application I am unable to locate org.springframework.boot.SpringApplication…
mevada.yogesh
  • 1,118
  • 3
  • 12
  • 35
4
votes
3 answers

Is this the correct way to return 204 "No Content" using Spring?

I'm trying to delete a resource setting http status NO_CONTENT using Weblogic and the response takes 30 seconds to complete. Am i misusing Spring or is there a bug in Weblogic? I've tried this on Weblogic 12.2.1.0.0 using Spring 5.0.12. The request…
4
votes
0 answers

Is there any benefit using Spring WebFlux over Spring MVC when paired with the blocking Spring Data JPA (or JOOQ)?

I wanted to find a good answer for this, but couldn't really find one. Most comments and articles just cite the fact that your whole stack should be reactive to get the full benefits. But that kinda suggests to me that there are some benefits of…
logi0517
  • 813
  • 1
  • 13
  • 32
4
votes
1 answer

How to i18n a Spring RestController on java.validation constraints?

How can I i18n a spring @RestController property on javax.validation constraints? I thought I could just add /src/main/resources/messages.properties and messages_de.properties, and then spring would detect them and enable proper i18n? But that seems…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
4
votes
1 answer

Spring boot 2: Plus (+) sign is not getting encoded in query param

Currently I am migrating one of my micro service to spring boot 2 from spring boot 1.x. consider there are two services A and B. Service A calls the rest end point of service B. In query Param service A is passing an alphanumeric string which also…
Sachin
  • 521
  • 3
  • 11
4
votes
3 answers

Does Spring Version 4.3.20 work with Java 11?

I am confused when it comes to the supported java-versions of spring 4.3.20. Updating a Spring 4.3.20 project to Java 11 worked without any hiccups what so ever. All my tests work fine, the webapp starts up and all the features of Spring that…
roookeee
  • 1,710
  • 13
  • 24
4
votes
2 answers

Multiple asynchronous HTTP requests using Resttemplate

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 parallel streams leveraging the fork-join common pool…
Sam
  • 861
  • 3
  • 10
  • 16
4
votes
2 answers

Spring RestTemplate handle exceptions

I am using Spring RestTemplate to make HTTP requests This is my code: public static ResponseEntity makeRequest() { ResponseEntity response = null; try { RestTemplate restTemplate = new RestTemplate(); …
Zak FST
  • 361
  • 3
  • 6
  • 17
4
votes
1 answer

Should OutputStream be closed explicit in StreamingResponseBody?

I'm streaming a big external resource using StreamingResponseBody in a spring @RestController. Question: should the OutputStream of the response body be closed explicit here? @GetMapping("/{filename}") public ResponseEntity
membersound
  • 81,582
  • 193
  • 585
  • 1,120
4
votes
1 answer

Cannot logout using spring security 5

I'd like to build admin portal for book management (get, add, delete, update a book). So I began with login/logout feature; the login part works like a charm but I'm facing a problem with logout. When I logout the admin portal keeps the session…
4
votes
1 answer

Can we use a single method to handle HTTP POST and PUT in Spring REST

We are building a new Rest service. I have a PUT method that looks something like this: @RestController public class RestController... . . @PutMapping("/api/entity1") public ResponseEntity entity1Put(@RequestBody Myclass…
BigTFromAZ
  • 684
  • 7
  • 22
4
votes
3 answers

Spring-Boot Embedded Tomcat - generate localhost.log and cataline.out files

I have a spring-boot application running with an embedded tomcat. We are using logback and slf4j for logging. I am trying to figure ways to generate catalina.out and localhost.log files through spring-boot application. It looks like catalina.out is…
jagamot
  • 5,348
  • 18
  • 59
  • 96
4
votes
0 answers

Spring boot REST MVC map request parameter with different field name to object

Assume that I have want to capture a bunch of request parameters as one object like this: @GetMapping("/") public List filterItems(@Valid Filter filter){} and the Filter class looks like this: class Filter { public String status; …
danial
  • 4,058
  • 2
  • 32
  • 39
4
votes
0 answers

Custom Login Page with Spring Boot and Vue.js

I want to use my custom loginpage, made with Bootstrap-Vue and the Vue.js, with my spring boot backend. I'm using Spring Security. This is my custom login form