ITPub博客

首页 > IT职业 > IT职场 > Spring Cloud Spring Boot mybatis分布式

Spring Cloud Spring Boot mybatis分布式

IT职场 作者:flashstone 时间:2021-09-09 09:19:29 0 删除 编辑

准备工作

首先,构建一个简单的Web工程,以用于后续添加安全控制,也可以用之前Chapter3-1-2做为基础工程。若对如何使用Spring Boot构建Web应用,可以先阅读《Spring Boot开发Web应用》一文。

Web层实现请求映射

@Controller  
public class HelloController {  

    @RequestMapping("/")  
    public String index() {  
        return "index";  
    }  

    @RequestMapping("/hello")  
    public String hello() {  
        return "hello";  
    }  

}  

/:映射到index.html
/hello:映射到hello.html
实现映射的页面

src/main/resources/templates/index.html

  
  
    
Spring Security入门

欢迎使用Spring Security!

点击 这里 打个招呼吧

src/main/resources/templates/hello.html


xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">

Hello World!


Hello world!




可以看到在index.html中提供到/hello的链接,显然在这里没有任何安全控制,所以点击链接后就可以直接跳转到hello.html页面。
代码来源

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3378/viewspace-2802196/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-14

  • 博文量
    72
  • 访问量
    577