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.

Spring MVC is an action-based (as opposed to component-based) web framework built on top of the Spring IOC Container. MVC stands for Model View Controller, a long standing design pattern that layers an application separating presentation concerns from business logic see Portland Pattern Repository's MVC Entry

The latest stable version is 5.1.4 and was released in January 2019, and the current docs can be found in the MVC section of the Spring Reference.

Spring Version 5.0 fully supports Java 9 features, this release now requires Java SE 8.

Major Spring Releases

  • First Release : Year 2004
  • Spring 2.0 : Intoduced namespaces and support.
  • Spring 2.5 : Anotation Based Configuration
  • Spring 3.0 : Strong Java 5+ foundation across framework, Introduced @Configuration model
  • Spring 3.2 : Java Based Configuration introduced
  • Spring 4.0 : Java 8 Support, removed Deprecated classes.
  • Spring 5.0 : Java 9 Support, reactive programming support

The Spring Framework comprises several modules that provide a range of services:

  • Inversion of Control container: configuration of application components and lifecycle management of objects, done mainly via dependency injection
  • Aspect-oriented programming: enables implementation of cross-cutting routines
  • Data access: working with relational database management systems on the platform using and object-relational mapping tools and with databases
  • Transaction management: unifies several transaction management APIs and coordinates transactions for Java objects
  • Model-view-controller: an HTTP- and servlet-based framework providing hooks for extension and customization for web applications and RESTfull web services.
  • Remote Access framework: configurative RPC-style export and import of Java objects over networks supporting , and HTTP-based protocols including web services ()
  • Convention-over-configuration: a rapid application development solution for Spring-based enterprise applications is offered in the module
  • Batch processing: a framework for high-volume processing featuring reusable functions including logging/tracing, transaction management, job processing statistics, job restart, skip, and resource management
  • Authentication and authorization: configurable security processes that support a range of standards, protocols, tools and practices via the Spring Security sub-project (formerly - Acegi Security System for ).
  • Remote Management: configurative exposure and management of Java objects for local or remote configuration via .
  • Messaging: configurative registration of message listener objects for transparent message-consumption from message queues via , improvement of message sending over - - standard APIs
  • Testing: support classes for writing unit tests and integration tests
58288 questions
17
votes
3 answers

ImageIO.read( ) always rotates my uploaded picture

I want to create a web application that allow users to upload their image to the server. When they click send, their image will be uploaded to the server (multipart). Before saving, I want to make some operation with the image, so I decided to use…
kp_ping
  • 495
  • 5
  • 14
17
votes
1 answer

Spring MVC, getting principal from security context in service layer

What are the advantages to get principal as a parameter Principal principal in spring controller and then pass it to service layer over getting principal in the service layer immediately though…
Alex
  • 11,451
  • 6
  • 37
  • 52
17
votes
3 answers

Spring request scope bean

How can I set up a bean which will created once per request. I Tried to do like this : @Component @Scope(value = "request") public class TestBean { @PostConstruct public void init() { System.out.println("start…
john Smith
  • 1,565
  • 7
  • 34
  • 54
17
votes
2 answers

context:property-placeholder not working for multiple files

I have got 2 properties file with me. I have mentioned both the files in the context:property-placeholder like this... Also I have tried this…
Freakyuser
  • 2,774
  • 17
  • 45
  • 72
17
votes
4 answers

Spring MVC handler returns String with extra quotes

I'm using Spring 3.1 and I have a handler that should return a String value. Here's how my handler looks like: @RequestMapping(value = TEST_HANDLER_PATH, method = RequestMethod.POST) public ResponseEntity handleTest(HttpServletRequest…
mkvcvc
  • 1,515
  • 1
  • 18
  • 41
17
votes
2 answers

How does the DispatcherServlet, Resolver and Controllers interact?

Ok so I have encountered the fairly common errror: WARNING: No mapping found for HTTP request with URI [/WEB-INF/jsp/index.jsp] in DispatcherServlet with name 'app' I'm looking at the existing answers and I've not seen a really good explanation of…
Philip Whitehouse
  • 4,293
  • 3
  • 23
  • 36
17
votes
2 answers

case insensitive mapping for Spring MVC @RequestMapping annotations

Possible Duplicate: How can I have case insensitive URLS in Spring MVC with annotated mappings I have Controller having multiple @RequestMapping annotations in it. @Controller public class SignUpController { @RequestMapping("signup") public…
Zahid Riaz
  • 2,879
  • 3
  • 27
  • 38
17
votes
4 answers

Controller belongs to the Presentation layer?

I heard that controller belongs to the presentation layer. How is it possible? I thought that : view is for presentation model is for business logic controller is for controlling logic Is there good link to prove that controller belongs to the…
Ramesh Kotha
  • 8,266
  • 17
  • 66
  • 90
16
votes
1 answer

How does one manage object pooling in Spring?

It's my understanding that in Spring, all objects are treated by default as singletons. If singleton is set to false, then a new object will be served at each request. But what if I wanted to pool objects? Say set a range from a min of 1 to a…
Cuga
  • 17,668
  • 31
  • 111
  • 166
16
votes
6 answers

Javascript and Java Date JSON serialization

I have an javascript object with Date property which is being converted to JSON using JSON.stringify I am on GMT+4 time zone (Russia/Moscow) For example, 5 Jan 2012 converts to 2012-01-04T20:00:00.000Z 5 Jan 1975 converts to…
ike3
  • 1,760
  • 1
  • 17
  • 26
16
votes
8 answers

how to write unit test case for controller class using mockito

I am very new to Mockito and jUnit and I try to learn the right way to do TDD. I need couples of example so that i can write unit test using mockito Following is my controller class which upload file and perform some action on this file…
Raje
  • 3,285
  • 15
  • 50
  • 70
16
votes
2 answers

Security for Spring Restful Web Services

I am writing a Spring Restful Web Services Project. I need to write secure Web Services. For Security I am already using Spring Security+SSL, however now i need some security for encryption and message signing. I know how to encrypt the message…
Rahul Taneja
  • 417
  • 1
  • 8
  • 18
16
votes
4 answers

What does do?

I use filenames in my REST API (example: GET http://xxx/api/myImage.jpg) problem is @PathVariable dropped ".jpg". this problems already asked few times in here and answered. but not worked to me. so I searched then found at…
Kisong Kim
  • 161
  • 1
  • 1
  • 3
16
votes
1 answer

List of Spring Runtime Exceptions

Does anyone know where I can find a list of Spring's (3.0.x) runtime exceptions? I'm talking about exceptions like DataRetrievalFailureException; there's a whole set of these runtime exceptions that you can throw.
Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
16
votes
4 answers

How to inherit RequestMappings in a Spring 3 MVC REST API

I'm trying to build a RESTful API using Spring MVC. I'm shooting for clean and manageable code where the package structure follows the url structure. So here is what I've got: // com.test.api.library @RequestMapping("/library/{libraryId}") public…
Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78