spring-projects / spring-projects/spring-boot

Provide easier way to configure view controllers

Open
#19,467 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
81.5k
Forks
42.7k
Avg merge
2d 4h
Merged PRs (30d)
65

Description

Currently registering a view controller requires a configuration class to be registered that implements WebMvcConfigurer. One needs to override …. addViewControllers(…) and usually adds lines like:

registry.addViewController("/login").setViewName("login");

This feels like quite a bit of boilerplate to register a URI to view name mapping. Especially if the URI is identical to the template name.

I've run into this trying to override the login form provided by Spring Security by default. Not sure I've overseen a simpler mechanism to tweak that but it seemed quite a bit of framework falling into my face for a pretty straight forward task of having a custom login template.

In case you think this is a too broad brush, I also wondered whether it'd make sense to establish a convention for a custom form login template location, so that simply placing a well-named template in a well-known location would tweak the MVC setup accordingly. This of course has other side effects, too, potentially affecting existing applications.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the WebMvcConfigurer and addViewControllers flow described in the issue, then examine how Spring Security's default login form is overridden. Define whether the goal is a simpler URI-to-view mapping, a convention-based template location, or both; done means an agreed, documented behavior that avoids unintended effects on existing applications.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.