The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [spring-mvc]

Based on the Model-View-Controller (MVC) pattern, Spring MVC helps you build web-based applications that are flexible and decoupled from the underlying view technologies.

Filter by
Sorted by
Tagged with
1
vote
0answers
29 views

Spring Boot - JPA query execution Time

Any one suggest me right way to write mapping more then one table using spring-boot (jpa), i was done it, but its required more time to extract result, Following are the Mapping of Pojo: First:- <...
0
votes
0answers
19 views

Given a resource ID, instantiate, retrieve and localize a Linked Resource for a REST API call

During a question on Stack Overflow, another user had some comments about the way this code works. He had a few choice words for it, including "magic", "ugly contraption", "you're doing things you ...
1
vote
0answers
96 views

Spring (boot) MVC Abstract Controller

I'm writing an application that will end up with a set of standard CRUD operations for a bunch of object types, and I thought it would help simplify things if all the separate controllers had some ...
2
votes
1answer
203 views

Effective & Secure Method to populate Access Token for authorization header in Rest Template

I am trying to consume a REST endpoint by using the RestTemplate Library provided by the spring framework. The endpoint also demands a Bearer Access Token as its authorization header, which is only ...
0
votes
1answer
32 views

Spring Boot methods to add and remove relationships

I have a Spring Boot application and I wrote a piece of code to manage relationships between two entities. The code consists mostly in these two methods: ...
1
vote
2answers
76 views

Reporting sums of shopping carts

I have an object (ShoppingCart) that has a list of CartItems, which contains the related ...
2
votes
1answer
3k views

CSV file download in Spring

I recently worked on a module, in which I implemented the functionality of downloading the CSV files. ...
0
votes
1answer
54 views

Refactor REST service with overcomplicated logic

Need to perform such actions: receive JSON from REST extract nexted JSON document calculate hash of the nested document add some fields to extracted document and save it in database return response ...
1
vote
0answers
91 views

Business logic validation as custom Bean Validation annotations?

This is not my solution but that of an existing application I am enhancing. Basically what they are doing is annotating a Form.java with a custom validator that ...
1
vote
0answers
35 views

Populating a CMS's database with some initial data

I have a simple content management system Spring-MVC web app made with spring boot. I have the following class called data loader that initially creates some objects and stores them in an H2 in-...
0
votes
1answer
147 views

Refactoring a class / map of query parameters that are passed between layers

There is an interface: interface JournalCreator { @Async Journal create(Parameters params); } And many different implementations: ...
2
votes
1answer
95 views

Maintaining session timeout globally in java spring configuration

Below is my code to maintain a session timeout globally in Java spring configuration and to load the session timeout value from a properties file. Do you have any suggestions to improve my code? <...
2
votes
0answers
35 views

Security exceptions

I'm trying to configure security exceptions to all JavaScript/CSS of my pages. I need to login to access the JSP files, except the login page, but all pages needs ...
0
votes
1answer
73 views

Spring: Creating a Mutable Common Command Object or Controller Interceptor

I'm integrating with a 3rd party vendor that has Users and Organizations in it. My tool is a user administration tool that ...
0
votes
1answer
45 views

Handling a response in a @Controller

I have a simple spring controller which takes a @ModelAtrribute object and registers an employee. If it is a success, I forward it to a success, else an error page, ...
1
vote
1answer
826 views

Spring MVC login controller

I am making a small project in Spring MVC. My login controller looks like this: ...
3
votes
1answer
4k views

Spring Boot RESTful service as a backend and reactjs as frontend app

let me please know what could be improved here. I've developed backend + frontend solution for the following task: Back-end: Create a simple Spring Web MVC application and manage dependencies ...
2
votes
2answers
8k views

Transaction in spring boot

I am using spring boot in my application. ...
1
vote
2answers
267 views

Spring Mvc RESTful app with MySQL

I recently write a Spring MVC RESTful app and this is the REST controller that I have worked on. I haven't work with Spring RESTful for a while and hence, provided, the code for suggestions of how to ...
1
vote
1answer
1k views

Spring MVC @ControllerAdvice exception handling

This is about handling sql - foreign key constraint failure exceptions (SQL Error: 1452, SQLState: 23000) globally using ...
2
votes
0answers
61 views

Generate a patch description from multiple SVN commits

I have a Spring app that is used to create patches for another application. My client retrieves a list of branches from a SVN repo through the initial AJAX call, then if one branch is chosen, another ...
1
vote
1answer
2k views

Service Layer in Spring Data

I'm building a small application in Spring and Spring Data JPA. I need serval layer. I don't know if I'm doing well. Here is an example: POJO ...
4
votes
3answers
10k views

Inserting 100000 records to MySQL takes too much time

I'm using spring boot, hibernate any MySQL for reading 100000 records from csv file and write the same to the database. I'm doing the batch insert where the data is committed at intervals equal to ...
1
vote
1answer
320 views

Spring MVC, Mongodb and java

I am avery beginner at SPring MVC, Mongodb and java. I am trying to make a sample application so that the user can serach, create, update and delete a customer: My CustomerDAO class: ...
1
vote
0answers
508 views

Uploading an image for a product in an online store

I am creating an online store using Spring MVC. The point is that when you create a new product you need to upload a picture for it. I am using the Cloudinary service, so when you upload, the image ...
5
votes
0answers
14k views

Spring MVC dynamically adding form elements

I made a simple form with an option of adding one text field dynamically on mouse click. And I will be grateful for suggestions on how I may improve the code. ...
1
vote
0answers
37 views

Formatting data in a UIViewController in a weight-training app

I'm writing a weight training app that calculates a one rep maximum and it has several options including recording your lifts in pounds or kilograms. I'm trying my best to follow the MVC pattern but I'...
1
vote
0answers
448 views

Spring MVC web app for simple ciphers

I'm working on a simple Spring MVC web app that allows users to encrypt and decrypt messages with classical ciphers such as the shift or Caesar cipher. It also allows users to auto-decrypt a message ...
1
vote
0answers
2k views

Spring MVC validation Multipart file in form

I need make validation of Multipart file in form class. I wrote custom annotation for form class which validate Multipart file. This code works great, but I don`t know if this is a good approach. ...
0
votes
1answer
424 views

Does this unit test cover all edge cases? [closed]

I want to test a simple controller and I want to know if this unit test covers all cases: Controller: ...
1
vote
1answer
177 views

Spring MVC controller

My code has a nasty smell that looks like this: ...
3
votes
2answers
96 views

Throw exception in Spring when loading a file

I have this following piece of code: ...
3
votes
1answer
142 views

Spring controller code to group information by date

I'm using the Spring Framework in my web application and I'm curious as to whether my controller implementations are good or not. I've used many Hashmaps to make a object that serves my purpose for ...
0
votes
1answer
6k views

Detect that a class is marked by a custom annotation in Spring

I would like to enable application behaviour based on the presence of a custom annotation that marks the configuration class (normally named something like ...
5
votes
0answers
2k views

Implement two level caching using spring's cache abstraction Cache and CacheManager

Details about spring's caching framework are here. When I was reading this link, I thought the composite cache mentioned there was one that used levels of caching based on the order given to the ...
9
votes
2answers
25k views

Preventing XSS attacks in a Spring MVC application controller

One of the URL in my application is vulnerable to XSS attack, so I am handling it in the below way. I created a util class: ...