Preparatory work
First, build a simple Web project that you can use to add security controls later, or use the Chapter3-1-2 as a foundation project. If you are building a web app using spring boot, you can first read the article "Spring Boot Development web App".
Web tier Implementation Request mapping
[Java] View plain copy
@Controller
public class Hellocontroller {
@RequestMapping("/") public String index() { return "index"; } @RequestMapping("/hello") public String hello() { return "hello"; }
}
/: Map to Index.html
/hello: Mapping to Hello.html
Implementing a mapped page
Src/main/resources/templates/index.html
[Java] View plain copy
<! DOCTYPE html>
<title>spring Security Primer </title>
<body>
<p> Click <a th:href= "@{/hello}" > here </a> say hello </p>
</body>
Src/main/resources/templates/hello.html
[Java] View plain copy
<! DOCTYPE html>
xmlns:sec= "Http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" >
<title>hello world!</title>
<body>
</body>
You can see the link to/hello in index.html, obviously there is no security control here, so click on the link to jump to the hello.html page directly.
Spring Cloud Spring Boot mybatis distributed micro-service Cloud Architecture (13)