58,838 questions
-2
votes
0
answers
37
views
Scalable image Upload using Spring MVC (Tomcat) [closed]
Requirement
I want a memory efficient way to upload images for scalability
I want to reduce the risk of high memory spikes during big loads. Therefore I initially had the plan to not store the whole ...
2
votes
0
answers
62
views
Spring Security from 5 to 7 migration, error 404 login submit
I'm upgrading from Java 17 to 25, Spring Framework 5.3.39 to 7.0.3.
Whenever I try to submit credentials via login page, I get error 404. Am I missing something to make this work?
Spring 7 ...
2
votes
2
answers
108
views
Can I use StreamingResponseBody with a generic ResponseEntity<?>
I have a situation where I need to sometimes return a stream (ResponseEntity<StreamingResponseBody>), and other times some other (synchronous) value (ResponseEntity<String>, etc.).
When ...
Best practices
1
vote
5
replies
64
views
SpringBoot: Refactoring new to bean, Parameter 0 of constructor required a single bean, but 2 were found
I wrote this simple Spring Boot project:
package com.example;
//just a simple interface, nothing spring-related here
public interface Foo {
String addFoo(String foo);
}
package com.example;
//...
-1
votes
0
answers
100
views
Spring Security intercepts controller exceptions and always returns 401 instead of actual error response
I am a beginner learning Spring Security. I have implemented JWT authentication along with a custom AuthenticationEntryPoint and AccessDeniedHandler.
When Spring Security is not enabled, any exception ...
Best practices
0
votes
3
replies
31
views
ViewControllerRegistry register view with model
Is there a way to bind data when registering a view? For example, I want to register a view named userProfile using ViewControllerRegistry and bind the model data needed for this page.
public void ...
1
vote
1
answer
85
views
Cannot resolve method findRequiredField in ReflectionUtils
I am trying to update entity fields dynamically using reflection in a Spring Boot application.
I wrote the following code:
public EmployeeDTO updateEmployeeById(Long employeeId, Map<String, Object&...
1
vote
0
answers
222
views
Spring Framework 7 (Spring Boot 4) API Versioning feature not behaves as expected
I am trying to understand the new API Versioning feature introduced in Spring 7 and seems like something is not right. According to the spring documentation, if versioning is enabled and no version ...
2
votes
1
answer
70
views
Message Source with Spring Boot
I am trying to use MessageSource with my Spring application for message constant. I tried everything but my message is not shown in Swagger.
/src/main/resources/message_en.properties
This is my ...
1
vote
1
answer
131
views
Spring Framework 7 (MVC): MappingJacksonValue deprecated - how to select JsonView dynamically per request
In Spring Framework 6 (Spring MVC), several of my @RestController endpoints return a MappingJacksonValue so I can set a Jackson serialization view dynamically based on the authenticated user’s group (...
0
votes
1
answer
181
views
What is the new way of extending AbstractMappingJacksonResponseBodyAdvice with Jackson3?
With Spring 6 I use a @RestControllerAdvice on a class extending AbstractMappingJacksonResponseBodyAdvice . This class injects a SimpleFilterProvider in the MappingJacksonValue provided by the ...
1
vote
0
answers
804
views
From which package do I import @WebMvcTest in Spring Boot 4.x?
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.webmvc.test.autoconfigure....
Best practices
0
votes
2
replies
40
views
Spring: How to use dynamic credentials for LDAP authentication?
I'm building a Spring service that uses
its own database to authenticate administrators and staff,
a central LDAP server (managed by someone else) to authenticate regular customers.
Whenever Spring ...
0
votes
1
answer
36
views
How should I set up a "RestExceptionHandler" for xhr requests and a "ErrorController" for non xhr requests in spring boot 3.5?
I am upgrading a rather big application from Spring Boot 2.7.18 to Spring Boot 3.5.6.
In this application there is an ExceptionController which is intended to handle exceptions
caused by non xhr ...
1
vote
3
answers
272
views
Using Pagination & Sorting in Spring Boot 4 with CrudRepository & PagingAndSortingRepository on JDBC
I am doing the learning on Broadcom's Spring Academy to be up to date with the latest best practices. I bumped Spring Boot to 4.0.0 instead of the 3.0.0 on Spring Academy. But I am having some issues ...