Questions tagged [spring-mvc]

52 questions
82
votes
6 answers

Service layer vs DAO -- Why both?

I have been working with SpringMVC, Hibernate, and some databases in a java web application example. There are a few different ones that do this, but this Spring 3 and hibernate integration tutorial with example has a model class, view (in jsp), and…
Jeff
  • 1,854
  • 3
  • 16
  • 19
9
votes
1 answer

Data Objects for each layer(DTO vs Entity vs Response objects)

Let's say I'm building a Customer web application(in Spring Boot 2), which also exposes rest end points. I'm modeling my application into 3 layers. a) UI - CustomerDTO b) REST - CustomerRESTResponse/CustomerRESTRequest Service - CustomerDTO Data…
Sandeep
  • 103
  • 1
  • 1
  • 5
8
votes
1 answer

Implementing a REST API in a Clean Architecture

I have been implementing a proof of concept application using Uncle Bob's Clean Architecture and I have run into a bit of a problem. Uncle Bob's architecture calls for the explicit separation of request and responses using interfaces. This is not a…
Carlos
  • 83
  • 1
  • 5
8
votes
1 answer

Passing multiple errors back from service layer

I am using Spring for a web application. To validate a user's input in a form such as for creating a Person entity I use JSR 303 validation to check for not null/empty or valid patterns etc.. Some things however I check in the service layer such as…
Goose
  • 195
  • 1
  • 6
7
votes
2 answers

Localization (i18n) with Spring boot with data in database

I am writing a Spring boot app with Thymeleaf, which should support two languages (or more). I have set up the locale resolver and messages.properties so now my app can translate static messages on locale change. The problem is, because there is…
Miha Jamsek
  • 249
  • 2
  • 7
6
votes
1 answer

What would be the market life of a JVM based software framework?

I saw how Struts 1 lasted from 2000 to 2013. I hear that people are moving from Struts 2 to Spring. But for a project that may need to be maintained for a decade or two, would it be advisable to opt for a framework or directly code with servlets and…
Nav
  • 1,173
  • 1
  • 11
  • 23
5
votes
2 answers

What is the recommended way to handle exception in Spring MVC

I have a Spring application, where we make few service calls to fetch data. There is a Data Layer in between the Controller and the Service layers. Controller (Request-Mapping) -> Data Layer -> Service Layer If we do not get the data from the…
Abhigyan Mehra
  • 201
  • 1
  • 2
  • 5
5
votes
2 answers

Simple and Composite transactional services: Question about separation of concerns and transactions

I believe I know the answer to this but I'm looking for any holes or anything I may be missing. This is focused on Spring and Java but could really apply to any programming stack. Anyway, we have a typical service layer annotated with @Transactional…
cbmeeks
  • 411
  • 1
  • 3
  • 12
5
votes
1 answer

Avoiding Double POST

We are implementing a RESTful webservice that will allow client applications to POST documents to it and it will store the document returning a unique identifier in the response. The clients will mostly be Spring MVC applications, but do not have to…
Paul Croarkin
  • 151
  • 1
  • 4
5
votes
1 answer

How can I scale spring application context?

I'm currently working on a project that need to be dynamically scaled on demand according to the need. My question is about scaling spring context. My web application has a classical multi module core (service, persistence, domain), which use use by…
Zenithar
  • 195
  • 1
  • 10
4
votes
1 answer

IEC 62304, Are Software Frameworks (Spring/JEE/Angular/React) considered SOUP?

Im working on the implementation of an IEC 62304 compliant development process in our company and I have a question considering SOUP (Software of unknown Provenance). Our goal is the develop a web application in the future. For this application we…
TardigradeX
  • 151
  • 3
4
votes
1 answer

Why do we use redundant CRUD methods in service and persistence layers?

I read few sentences of this. I understand that simply put, the persistence layer (with its repository objects) deals with basic data access CRUD. The service layer on contains business logic. In my view, a service object contains multiples CRUD…
Jason Krs
  • 179
  • 6
4
votes
1 answer

DTO can be considered as Business objects (with behavior)?

Based on this Question and its answer : Object in Business layer same as DTO with logic? I want to ask : What if instead of DAL, I'm getting data from a remote service (API) through DTOs. My DTOs here represent prettymuch the business objects…
Mohamed Amine Mrad
  • 733
  • 1
  • 7
  • 12
4
votes
3 answers

Allowing users to add their own custom fields in a Spring MVC Hibernate application - What's an ideal approach?

We all may have seen applications like JIRA, or many CRM or other applications that allow its users to define their own custom fields to an entity, and do a variety of stuff with it, like making them mandatory, validate their values and so on. I…
4
votes
2 answers

Spring MVC - Handling validation errors using AJAX

I'm new to Spring MVC, hence the question may appear trivial. I have a login form which is submitted via ajax and in return I receive a ModelAndView (displaying existing list of contacts of the user) from the Controller, which I use to overwrite the…
Abhigyan Mehra
  • 201
  • 1
  • 2
  • 5
1
2 3 4