Spring Security Login ViewResolver
When integrating with Spring Security the view is not found, for non-secured pages the view works fine but for a page configured as login page in spring security, i get an error like so
`ERROR 10500 --- [admin] [nio-8080-exec-9] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)] with root cause
jakarta.servlet.ServletException: Circular view path [login]: would dispatch back to the current handler URL [/login] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)`
@humanry Do you have an example repo? Do you have a custom login page (with jte) or want to use the default one?
The view name should not include a forward slash; instead, change it to "login".
Usually in Spring the view name can start with a forward slash. Maybe it would be nice to enable this with JTE too.
This does NOT work:
public class GreetingController {
public static final String PATH = "/greeting";
@GetMapping(PATH)
public String greeting() {
return PATH;
}
}
But this works:
public class GreetingController {
public static final String PATH = "/greeting";
@GetMapping(PATH)
public void greeting() {
}
}
the implied viewName is "/greeting" but Spring removes the forward slash, I guess, before JTE can resolve the name
As the default template location is src/main/jte (and suffix is .jte) it would make perfectly sense to add a slash at the beginning of your viewname like /greeting, combined it would be src/main/jte/greeting.jte