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

Immutable objects and Spring/Spring MVC: the right choice?

I usually try to design my classes as immutable classes, so I have a lot of advantages in terms of coding stress. But working with Spring, I sometimes notice that the framework "discourages" this kind of design in most cases, in favour of classic…
davioooh
  • 23,742
  • 39
  • 159
  • 250
17
votes
5 answers

Simple example of Spring Security with Thymeleaf

hi I'm trying to follow a simple example about doing a simple login form page that i found in this page http://docs.spring.io/autorepo/docs/spring-security/4.0.x/guides/form.html the problem is that i´m getting this error everytime that i try to…
stackUser2000
  • 1,615
  • 11
  • 32
  • 55
17
votes
11 answers

Intercept @RequestHeader exception for missing header

I have a method in controller with has parameter for example @RequestMapping(value = "/{blabla}", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED) public void post(@RequestHeader("ETag") int etag) If there is no ETag header in…
Ruslan Islamov
  • 173
  • 1
  • 1
  • 5
17
votes
4 answers

Setting the default jsp view with spring mvc

I want to set one of jsp files in my jsps folder as the default view for the application. Is there any way we can tell in that abc.jsp needs to be default and it can be found in such and such path. Also the url pattern is html so…
Walker
  • 891
  • 2
  • 11
  • 26
17
votes
6 answers

Delete or put methods in thymeleaf

I would like to call @RequestMapping(value = "", method = RequestMethod.DELETE) in spring from thymeleaf form. Is there any possibility to call delete or put request mapping methods from thymeleaf? please give your suggestion on this.
user3128455
  • 741
  • 2
  • 7
  • 9
17
votes
7 answers

What is the best view layer for Spring 3?

I'm investigating presentation layers to be used with spring in our new project. I'm coming from PHP+Prado and want to move to something what is as simple as Prado and more powerfull than PHP. I like Spring 3 and Spring MVC. It's very simple to…
Piotr Gwiazda
  • 12,080
  • 13
  • 60
  • 91
17
votes
2 answers

Spring mvc HandlerMapping VS HandlerAdapter

I have been reading Spring MVC HandlerMapping and HandlerAdapter but I am getting confused between this two concepts.I can understand that HandlerMapping is used to map incoming HTTP request to controller but what is the use of HandlerAdapter?why do…
Flying_Machine
  • 323
  • 1
  • 4
  • 15
17
votes
7 answers

Spring-Hibernate : Illegal attempt to associate a collection with two open sessions

I am trying to update record in MySql Db. while updating it threw following exception org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions at…
Manish Mahajan
  • 1,140
  • 1
  • 14
  • 38
17
votes
1 answer

What is in spring tag used for?

Can someone please tell me what do I need to specify in path attribute and what it's used for? actually I need to understand how the value of the selected item from the dropdown is passed onto the controller?
Shivayan Mukherjee
  • 766
  • 3
  • 10
  • 33
17
votes
4 answers

Is there a way to make Spring Thymeleaf process a string template?

I would like to write something like : @Autowired private SpringTemplateEngine engine; .... // Thymeleaf Context WebContext thymeleafContext = new WebContext(request, response, request.getServletContext(), locale); // cached html of…
Serge Tahé
  • 1,869
  • 2
  • 19
  • 20
17
votes
1 answer

Using jdbcAuthentication in Spring Security with Hibernate

I just finished an Spring application which is based on the inMemoryAuthentication(), and now, after verified all are working perfectly, I want use the JDBC Authentication. I have three kinds of classes to handle the connection to the…
Kleber Mota
  • 8,521
  • 31
  • 94
  • 188
17
votes
4 answers

Why this Spring application with java-based configuration don't work properly

I started recently a project with the Spring framework with the ojective to develop it without none XML config file, only Java code. In this current moment, I add the follow files to my…
Kleber Mota
  • 8,521
  • 31
  • 94
  • 188
17
votes
4 answers

failed to lazily initialize a collection of role,..could not initialize proxy - no Session - JPA + SPRING

I am using JPA(with Hibernate 4.3.3 as persistence provider ) along Spring (3.2.2) , all my fields are loading fine but when I am trying to access my Collection it's throwing the error- Exception in thread "main"…
henrycharles
  • 1,019
  • 6
  • 28
  • 66
17
votes
9 answers

How to access Spring MVC model object in javascript file?

I am using spring 3 MVC and i have below classes. External system would call my application using below URL: http://somehost/root/param1/param2/param3 I have a spring MVC controller method as below: public ModelAndView…
user755806
  • 6,565
  • 27
  • 106
  • 153
17
votes
2 answers

Spring Boot and @ComponentScan between two jars

I have 2 projects. One is a DAL project that does CRUD operations on a neo4j DB using spring neo4j APIs . This project is packaged as a jar and included in project #2. Project #2 Is a Spring restful services project that uses spring boot to package…
Muhi Masoud
  • 207
  • 1
  • 3
  • 7