1,615 questions
0
votes
1
answer
107
views
Spring Boot 3.x — @RestControllerAdvice not catching custom exceptions
I recently upgraded to Spring Boot 3.5 (Jakarta packages) and noticed my global exception handler isn’t being triggered.
@RestController
public class UserController {
@GetMapping("/test")...
1
vote
1
answer
63
views
Spring boot 3.4.7 @Valid validation allows empty json on a PUT/PATCH rest endpoint
With the use spring boot 3.4.7 noticing a below change
We have a pojo with lomobok annoatiaon
import org.springframework.validation.annotation.Validated;
@Builder
@Validated
public record AppState(
...
2
votes
0
answers
38
views
Spring Boot REST endpoint seems to not execute Neo4j Java driver statements (JHipster + Neo4jConfig + Neo4jService) → no Cypher run
I am integrating Neo4j into my JHipster 8.5.0 / Spring Boot 3.3.0 application.
I have configured a Neo4jConfig with a Driver bean, a Neo4jService to send Cypher statements, and a REST endpoint /api/...
0
votes
1
answer
47
views
Form URL encoded data and Spring Rest Controller, data coming as null
We are getting a request from 3rd part and in our logs the body is printed like this
"body":"Response=%7B%22TransactionType%22%3A1%2C%22Approved%22%3Afalse%2C%22TransactionIdentifier%22%...
0
votes
1
answer
150
views
How to fix this: Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' is not supported
I have a Spring Boot REST API, and it works perfectly when tested via Postman—all HTTP methods function as expected. However, when I try to interact with the API from the client-side application, I ...
0
votes
2
answers
52
views
Spring restcontroller with RequestParam String conflcting in controller
I have a Restcontroller with 4 methods, but I can't use the calls, I always get the error: "message": "No static resource api/corp.",
I need method with string like:
localhost:...
0
votes
1
answer
410
views
Content-Length header is removed from HEAD response
We have a REST controller with a HEAD method but no GET method. We don't want the client to be able to retrieve the resource, but we do want them to be able to know whether it exists and how big it is....
1
vote
3
answers
99
views
Spring Boot Controller Not Registering and 404 Error on POST Request
I’m working on a Spring Boot application, and I’m having trouble getting my controller to register correctly. When I try to POST data to the /student/add endpoint, I receive a 404 error, indicating ...
0
votes
1
answer
104
views
Unexpected 401 error at testing RestController
`
I'm trying to test the login method by adding a user, and when I want to login, I get a 401 response insted of 200
UserController
/**
* Login form
* @param user the user we are trying to log in ...
0
votes
1
answer
245
views
Best way to handle returning success (i.e. 20X) responses AND failure (i.e. 4XX, 5XX etc..) responses in Java Spring Boot?
I know within the Spring @RestController class, we can do something like:
@GetMapping("/"
public ResponseEntity<Weather> getWeatherRecordsById(@PathVariable Integer id){
...
0
votes
1
answer
66
views
How to implement exception handling in a mixed MVC and REST Spring application?
Spring Boot 3.2.x / Spring Web 6.1.x
In an app with both MVC controllers (returning HTML pages via JSP) and REST controllers, how can I implement global exception handling such that MVC controller ...
0
votes
1
answer
51
views
Spring MVC pass object from list to post-endpoint
I have a spring-controller with a post-endpoint that receives a WordDto. Another get-endpoint puts a list of WordDtos in the ModelMap and shows a jsp-file. In the jsp-file, I show each entry of the ...
0
votes
2
answers
186
views
How to Access a Request-Scoped Bean in a Spring Exception Handler?
I need to log trace information using a Tracer bean, which is request-scoped, in both my REST method and exception handler. The Tracer bean is consumed in the REST method to log the trace information ...
-1
votes
1
answer
106
views
Issue in spring boot 2.7.6 returning NoHandlerException for GET '/v3/test/'
I am using spring boot 2.7.6, Gradle 8.6 and here is the application.properties file
spring.mvc.servlet.path = /v3
spring.mvc.throw-exception-if-no-handler-found = true
spring.mvc.static-path-pattern=/...
1
vote
0
answers
39
views
Spring boot @RestController throwing 404
I have two rest controllers on the same package level with following code:
First controller:
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping(API + NO_AUTH + "/payments/...
0
votes
0
answers
58
views
Is it possible to accept file without any key in multipart-formdata? (blank key)
In multipart formdata we accept the parts as with key-value pairs, is it possible to handle request with file without any key?
curl --location --request GET 'endpoint'
--form '=@"/C:/Users/User/...
0
votes
1
answer
100
views
Custom LoginController in Spring Security and post with Angular
Im trying to create my own LoginController so i can watch the data flow more closely, but either my post method is wrong or my controller is missing something.
Whenever I try to send a login request ...
0
votes
1
answer
74
views
QueryDsl: Customize predicate with Rest Controller
public Page<DemoDto> find(
@QuerydsPredicate(root = DemoEntiy.class) final Predicate predicate,
@PageableDefault(size = 100)
@SortDefault(sort = "id", direction = Sort....
0
votes
1
answer
318
views
Spring boot RestControllers doesn't work with library containing @Entities
I have a spring boot (3.2.1) application that run on java 17. I also have library that contains @Entity annotations. I am connection to database using spring boot default Hibernate. I am able to ...
0
votes
3
answers
169
views
problem - "404 error" for localhost:8081/question/allQuestions
application properties:
# Database Connection Properties
spring.datasource.url=jdbc:mysql://localhost:3306/quizmaker
spring.datasource.username=root
spring.datasource.password=Corona@123
# Specify ...
0
votes
1
answer
54
views
JSON returns only the last entry of a Hashmap property via Spring Boot Rest Controller
I have a Map<Object, List> property. It correctly persists to SQL and a Spring Boot Repository correctly returns the Map. However, the JSON response from a Spring Boot Rest Controller only ...
0
votes
3
answers
3k
views
@ManyToOne and @OneToMany adding and retrieving problem in springboot
I am encountering a problem in my Spring Boot JPA application related to relationships between the Owner and Car entities. The issue arises when attempting to associate a new Car with an existing ...
1
vote
1
answer
764
views
perfoming a Junit test with JsonPath not working
I am running a unit test on a rest controller method addUser() which executes successfully without JSON path. Anytime I try to use jsonPath to perform strict data assertion to verify the content of ...
1
vote
1
answer
312
views
Spring REST Endpoint: 404 requested resource is not available error
I created spring boot starter project with Rest application. When trying to run the application as Run on server it will redirect to web browser with URL till context-path but after adding endpoints ...
0
votes
1
answer
4k
views
OpenAPI Swagger API not sending "Authorization" header along the API call
Environment :
Java 17
Service is on Spring Boot 3
OpenAPI dependencies : 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0',
'org.springdoc:springdoc-openapi-starter-common:2.1.0',
'...