Issues regarding usage of Spring MVC @RequestMapping methods
Questions tagged [request-mapping]
348 questions
1
vote
3 answers
How to make Get Request with Request param in Postman
I have created an endpoint that accepts a string in its request param
@GetMapping(value = "/validate")
private void validateExpression(@RequestParam(value = "expression") String expression) {
System.out.println(expression);
//…

Bhumika
- 45
- 2
- 10
1
vote
1 answer
Deserialize Params into object
I have a URL abc.com/loc/lat=90.6&long=44.6&sf='random' here lat and long are required and sf is an optional param. I have created a class with these three as data members, how can I deserialize those params into that class object?

Aman Saxena
- 13
- 4
1
vote
0 answers
Post a from with a MultipartFile using RestTemplate
How do I post the following POJO to a @PostMapping using a RestTemplate
@Data
public class Form{
private Long customMetaData;
private String moreCustomMetaData;
private Date evenMoreCustomMetaData;
private MultipartFile file;
}
Which…

pmaurais
- 734
- 2
- 9
- 30
1
vote
1 answer
Request mapping and static fields
I am trying to set value for @RequestMapping annotation as follows:
@RequestMapping(value = VALUE)
@RequestMapping(value = VALUE)
public class SomeClass {
public final static String value = randomValue();
public static randomValue() {
…

Andriesi Claudiu
- 86
- 6
1
vote
1 answer
Spring Controller method being called again with the own method result
This is my controller:
@Controller
@RequestMapping("/area")
public class AreaController {
@RequestMapping("/{id}")
public String getPage(@PathVariable("id") int id){
return "asd3333";
}
}
and this is what I get when I access…

Murillo Tavares
- 82
- 5
1
vote
1 answer
Spring Boot Duplicated Endpoints
The first thing to clarify is that perhaps the title is not very concrete but I do not know how to express it better because I do not understand the problem I have.
A little bit of context:
I have a Spring Boot application with JWT authentication…

v3he
- 35
- 6
1
vote
1 answer
Microservices APIs URL pattern
I want to know the standard way of designing API calls URL to Microservices.
I have 2 microservices Example- User, Order. APIs created will be used in my application UI and also for any third-party integration.
Which Url pattern should I…

Pranav
- 167
- 2
- 12
1
vote
2 answers
Hybris ?site=electronics always redirect to electronics site
Whenever I am hitting the URL https://localhost:9002/trainingstorefront/?site=electronics, it always redirects to the site homepage. How this request mapping actually happens and where does it decide that which is the site to be loaded.

Rajat Singhal
- 11
- 4
1
vote
0 answers
Spring Boot Post method not working with @RequestMapping
I am new to spring boot, creating a simple CRUD operations using Rest API. I have written two methods one for GET and POST. Get works fine but when I try to access post method it's not working its shows 404 error.
@RequestMapping(value =…

Vicky
- 401
- 1
- 5
- 11
1
vote
1 answer
How to send PUT request with variable path parameter AND request parameter in the same endpoint with JMeter?
I'm using a Jmeter 5.3, and a need send PUT request with PathVariable AND RequestParam in the same endpoint.
Example:
@RequestMapping(value = "/authorize/{iduser}", method = RequestMethod.PUT)
public ResponseEntity authorizeUser(
…

Madson Silva
- 53
- 1
- 4
1
vote
2 answers
Using a String variable in RequestMapping value
I have the following:
@Value("${apiVersion")
private String apiVersion;
@RequestMapping(value = "/{apiVersion}/service/call", method = RequestMethod.POST)
And I expected the URL to be:
/apiVersion/service/call
But it turns out {foo} accept any…

A.J
- 1,140
- 5
- 23
- 58
1
vote
0 answers
How to redirect param from GET method to POST method
If I have errors on the form, I want to redirect the view to the get method. Is this a good practice?
In the POST method, I have employee and addresses. The first is the Employee object, the second is the list of two addresses. How to transfer them…

Bartek K
- 41
- 5
1
vote
2 answers
Read RequestMapping annotation value
To be able to do stats per endpoint, I want to be able to get the @RequestMapping annotation value, the parameterized version. My monitoring tool otherwise will consider different ids as different urls:
@RequestMapping(value =…

Icegras
- 173
- 1
- 3
- 8
1
vote
4 answers
Spring @GetMapping is being ignored
I have the following controller:
@RestController
@RequestMapping("/api/{brand}")
public class CarController {
private final CarService carService;
@Autowird
public CarController(CarService carService) {
this.carService = carService;
…

Titulum
- 9,928
- 11
- 41
- 79
1
vote
3 answers
How to use spring boot java to properly use axios.post from React
So I am using axios.post on React
here is my code
React GenService.jsx
import axios from "axios";
import { Route, withRouter } from "react-router-dom";
const COURSE_API_URL = "http://localhost:8080";
class GenService {
retrieveAll() {
…

Nabil Mehtab
- 37
- 1
- 3
- 7