Angular 4.0 + Spring boot + Spring Security: TemplateInputException: Error resolving template “login”

后端 未结 1 795
轻奢々
轻奢々 2021-01-16 17:09

I am integrating Spring Security in my first Angular project. I followed many articles and examples including this, this, this, this and this. I want my application to have

1条回答
  •  一整个雨季
    2021-01-16 17:49

    @SK

    The reason you are getting the below exception is you are using Controller and not RestController.

    org.thymeleaf.exceptions.TemplateInputException: Error resolving template "login", template might not exist or might not be accessible by any of the configured Template Resolvers at org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:246) at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1104)

    So instead of directly writing the output to browser as JSON, it is doing ViewResolver to resolve the view part of MVC.

    Replacing Controller with RestController will make the .formLogin().loginPage("/login") to make the browser request with login, and as it permitted you will get the login page of angular.

    httpBasic, it is the nature of browser for pop up as it gets a 401 response code.

    0 讨论(0)
提交回复
热议问题