Questions tagged [spring-mvc]
A framework for building Java web applications based on the Model-View-Controller (MVC) pattern. It promotes flexible and decoupled code from the underlying view technologies.
58,132
questions
0
votes
0
answers
12
views
Cant map the value form Vault to application.yml
I'm working with HashiCorp Vault and want to map the key-value from Vault json file to a application.yml placeholder, but catching the NPE when making request to call another service
that's my Vault ...
0
votes
0
answers
14
views
View Page is not rendering in Thymeleaf and Spring boot
I've written my front end on thymeleaf and backend is in springboot and I've my this view page https://i.imgur.com/qOHWi4E.png and I am applying a search feature on it, and when I search the element ...
0
votes
0
answers
10
views
Handle multiple Nytimes path response with common base response class
I'm trying to implement NYTimes APIs. As of now, the idea is simple, just hit the desired endpoint from the application and call the NYTimes API behind the scene.
But problem comes here, I have ...
-3
votes
1
answer
23
views
what is the difference between @PathVariable vs @PathParam vs @RequestParam vs @QueryParam and @RequestBody in spring boot microservices
Can anyone please explain these at once. I am getting confused with pathVariable and pathparam.
Where should we not use these?
-1
votes
0
answers
15
views
How to fix Spring-aot-maven-plugin issue on mvn clean package
Spring-aot-maven-plugin failing on mvn clean package [duplicate issue]
I have a similar issue with this user: https://stackoverflow.com/questions/66986235/spring-aot-maven-plugin-failing-on-mvn-clean-...
0
votes
0
answers
19
views
Why can't I resolve an MVC view in IntelliJ using Spring?
this is my code but when i run this program tomcat showing 404 error and intellij show can not resolve mvc view. No matter what I do, the same error appears again. I don't know if the problem is with ...
0
votes
0
answers
16
views
Is it possible to "embed" the id of the current user in a fragment of thymeleaf?
I have a header which is present on all pages, on the header there is a button which moves to the own page of the current user.
How to "sew" into this header, so to speak, the id of the user,...
0
votes
0
answers
9
views
Why is my Spring MVC application showing HTML source code in WAS9 production environment?
JSP pages sometimes showing html viewsource code rather than showing output.
This application is running in production for last two years and suddenly all the jsp pages showing html viewsource code ...
0
votes
0
answers
6
views
Unsafe deserialization in Spring RemoteInvocationSerializingExporter could lead to remote code execution
I have the following dependency and its causing the above issue
<properties>
<spring-boot.version>2.7.10</spring-boot.version>
</properties>
<dependency>
<...
0
votes
1
answer
41
views
Spring boot + JPA problem with post mapping form where is select multiple
I have a PostMapping whith form where user can create a meeting and invite employees. My problem is that the employees are not saved to the database.
Here is my MeetingDTO:
@Data
@Builder
public class ...
1
vote
0
answers
14
views
Is it possible to replace Spring Cloud Netflix Zuul with Spring Cloud Gateway in an Spring MVC App?
I am working on a Spring Boot App, that uses Spring Cloud Zuul.
Zuul is used for routing and for filters of the types PRE, POST, ROUTE and ERROR.
Because of the EOL of Zuul I want to switch to another ...
0
votes
1
answer
21
views
My validation doesn't work in one project but works in another
I connected validation to my project, but it just does not work. I checked several times whether I forgot anything - everything seems to be fine. I created test files: Controller, service, repository, ...
0
votes
0
answers
9
views
How can I redirect a successful login to a specific URL in Spring MVC without using session attributes?
I have been working on Spring MVC project and below are the point:
when customer comes to login page url is like : /login?target=/tnc
if customer enters incorrect login credentials url becomes: /login?...
0
votes
0
answers
7
views
How can I speed up Spring and Spring MVC startup times?
Application startup is taking is so much time more than a minute in scanning of the packages and creating application context .
applicationContext = new AnnotationConfigApplicationContext(packages) ;
...
0
votes
0
answers
10
views
I get this error : not-null property references a null or transient value : model.Agent.direction
In my **JAVA SPRING BOOT** application, I have two entities AGENT and DIRECTION and when I try to register an AGENT that is assigned to a direction I get this error: **not-null property references a ...
0
votes
1
answer
26
views
How can I fix the error 'Could not autowire. No beans of 'AuthenticationManager' type found' in Spring Security implementation?
package com.calorie.calorie.tracker.service;
/*
* Implementation of SecurityService interface
* */
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory....
0
votes
0
answers
18
views
How to solve repackage failed: Unable to find main class [closed]
Tried various ways that was found in stack overflow and other sites but still its not working.
The error message is attached here
enter image description here
0
votes
0
answers
8
views
How to make this dynamic request mapping work on multiple hosts?
In my spring application, I have support for dynamic paths using RequestMappingHandlerMapping.registerMapping like the solution suggested in this post.
This works when there is only one host serving ...
0
votes
0
answers
34
views
Batch Execution possible in SQL?
I have 30k rows of data in excel file, I need to figure out the values which are not present in database.
For this I have made an spring boot rest endpoint which reads the excel and queries the ...
1
vote
1
answer
12
views
Is it possible to generate correct OpenAPI yaml file for Spring Rest Controller in case response as ResponseBodyEmitter instead of ResponseEntity
I can easily generate OpenAPI yaml file for RestController methods that return ResponseEntity such as
public ResponseEntity<SomeResponseDto> getSomething() {
...
return responseEntity.ok(...
1
vote
2
answers
55
views
NullPointerException Repository in Spring controller class [duplicate]
I'm getting NullPointerException in the bellow code at controller itself. Before going to service class. I couldn't find where I go wrong. As I'm new to spring.
java.lang.NullPointerException: Cannot ...
0
votes
1
answer
18
views
WebMvcTest, exclude Repository interfaces from test
Setup
In my Spring Boot 2.7 application I've registered a simple ViewController using ViewControllerRegistry, so have no dedicated Controller for the start page:
@Override
public void ...
0
votes
0
answers
18
views
How to disable Keycloak security for a particular API gateway?
I have a Restaurant service. It exposes two endpoints (/v1/restaurant/order, /v1/restaurant/personalInfo). Some requests will be coming through API gateways and some will be coming directly to our ...
0
votes
0
answers
18
views
Customizing local paging default size for a single controller method with the default values defined in the application.properties
If no query parameters (page & size) are given, I'm trying to set the Pageable object value and populated with the default values defined in the application.properties. If query parameters are ...
-1
votes
1
answer
22
views
CORS issue during file upload and download in [framework/library]
Description
I'm encountering a CORS (Cross-Origin Resource Sharing) issue specifically when performing file upload and download operations in my angular-springboot3 application. The CORS problem ...
0
votes
0
answers
15
views
spring static is not loading until restart application
I'm using Spring framework on maven with Java 17 and intelliJ, and I have few endpoint to get the image from the server and they all work, as the title say I have problem after i upload image to ...
1
vote
1
answer
35
views
Spring Boot security redirects to login page instead of the desired page (register.html) [closed]
I'm working on a Java Spring Boot application with Spring Security for authentication and authorization. I have configured the security rules and defined the access permissions for different URLs. ...
0
votes
1
answer
24
views
The custom error page is not working for URLs with the '%' sign
The custom error page is not working for URLs with the '%' sign.
I get the response with an error page as expected if an error occurs during request processing. However, if I try to perform the ...
0
votes
0
answers
11
views
Custom HandlerMethodArgumentResolver order problem
I have a custom HandlerMethodArgumentResolver.
public class DeviceKeyParameterArgumentResolver implements HandlerMethodArgumentResolver {
private static final List<String> ...
0
votes
1
answer
16
views
Unable to validate login page in Spring
Trying to validate a simple login page using spring, but 404 error comes.
This is the directory structure of my project.
This is my LoginController.java
package com.example.login;
import org....
-2
votes
0
answers
16
views
How do I solve Exception in thread "main" java.util.zip.ZipException: zip END header not found [closed]
I am trying to run a spring mvc project I got from spring.io and I keep getting this error anytime I try to build it on netbeans, I haven’t added any code to it it’s straight from spring.io. I have ...
0
votes
1
answer
37
views
Upgrading to Spring 5 - 404 page not found error
I am in the middle of upgrading a legacy project. Currently upgrading from spring 4 to spring 5.
The login works fine but the user is taken to the change password screen due to an out of date password....
-1
votes
0
answers
14
views
Dynamic Spring modelAttribute name in webpage
I am not sure whether this is technically possible, but can you set a dynamic model attribute name and directly reference this in a webpage, I am guessing it isn't as it can't scan the component and ...
0
votes
1
answer
51
views
Why is ResponseEntity<Foo> geting a different result to ResponseEntity<String>?
For my Java Spring Boot Application (v2.7.12), I am performing a GET request using restTemplate.exchange() which passes in my correct url, HttpEntity with the correct headers, and response type ...
0
votes
0
answers
7
views
Why is com.google.code.kaptcha.Producer.createText() considered a non-accessor method in my SpringBoot REST Controller?
I use com.github.axet:kaptcha:0.0.9 library in my SpringBoot 3.0.5 project. I want to generate image captcha in a method of REST Controller. The code is written in Kotlin.
@Configuration
class ...
0
votes
1
answer
14
views
trouble calling controller deployt under apache tomcat 10.x
i deployed a small java maven springmvc web application on tomcat10.1.8/10.1.9. Even though I've added all the dependencies I need related to jakarta changement, I'm having trouble invoking the ...
0
votes
0
answers
50
views
Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'appUserRepository'
i have a problem about creating bean with name appUserRepository defined in com.example.taskcrud.Repository.AppUserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar....
0
votes
0
answers
13
views
how to store state in mvc application, in such a way that state can be used by newly spun threads
I have a webmvc application. I store state via RequestContextHolder, which stores the attributes in the HttpServletRequest object. This way I don't have to pass around the state in every class/methods....
0
votes
1
answer
29
views
Spring MVC ResponseEntity for image not found
In Spring MVC I'm trying to handle "image not found" case with appropriate response but no luck so far.
When catch block executes, in Chrome browser I get status "(failed) net::...
1
vote
0
answers
52
views
How to validate objects of collection on Controller with Validated?
I have the following DTO that I want to validate:
@Data
public class ContinentDto {
@Null(groups = { CreateValidation.class }, message = "ID must be null")
@NotNull(groups = { ...
0
votes
0
answers
39
views
Unsupported content type 'application/octet-stream' when decoding file part
I have Spring Web service consuming Multipart:
@PostMapping(path = "uploadFile", produces = "application/json")
public ResponseEntity<Boolean> uploadFile( ...
0
votes
0
answers
18
views
JSP file is automatically downloading instead of displaying content in Spring Boot app, how to resolve?
I am working on spring boot web application project.
when ever I run spring boot web app It runs well, but in the browser when I excess this web app content, my jsp file automatically downloads ...
0
votes
0
answers
32
views
Why does the index page don't appear when entering the url after launching the app?
Guys I have cloned a spring boot project but every time I try to launch the app and enter the url for the index page it give me alot of errors
the url is 127.0.0.1:8070
I tried to change the ...
1
vote
2
answers
58
views
Repository not injected in service class when initialized through a factory class
I have multiple implementations for a method, so I decided to use Factory design pattern for it. Here is the implementation for factory class:
@Component
public class ProcessFileFactory {
private ...
0
votes
0
answers
16
views
Upgrade spring mvc to spring 6 stops mapping static resources folder to index.html
I have a spring mvc application and I am upgrading that to spring 6. The upgrade was successful but having issues with static resources. I have help files in the application and I have mapped /help/** ...
0
votes
1
answer
25
views
html page can't read from model spring boot thymeleaf
I have the following controller
package com.website.school;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;...
0
votes
1
answer
32
views
spring boot 2.7.0 the thymleaf does not show authenticated user detail
The following code is the SecurityConfig class:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context....
0
votes
1
answer
38
views
"404 not found error" MVC model with tomcat
I'm trying the MVC model with spring and my goal is to show the home page, I tried different ways to solve the problem but the problem still exists
Here is the error :
HTTP Status 404 – Not Found
...
0
votes
0
answers
15
views
How asynchronous request processing works in Spring MVC
i have a problem understanding asynchronous processing
I've read about DeferredResult and everywhere there is information that it is asynchrnous
because it allows to unblock http thread and delegate ...
2
votes
1
answer
64
views
Is there a reason why Spring MVC doesn't apply a limit to the maximum number of bytes to buffer in memory for input stream like WebFlux?
For the first time I noticed this error in my Spring WebFlux application:
org.springframework.core.io.buffer.DataBufferLimitException: Exceeded
limit on max bytes to buffer : 262144
So WebFlux has a ...