• 大小: 19.18MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-01
  • 语言: 其他
  • 标签: Spring-Secur  Demo  java  

资源简介

按照教程https://blog.csdn.net/ryo1060732496/article/details/78848205 编写的demo程序

资源截图

代码片段和文件信息

package demo.spring.security.hello.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping(“/“)
public class HelloWorldController {
    /**
     * 返回 hello 视图
     *
     * @return
     */
    @RequestMapping(value = {“/“ “/welcome**“} method = RequestMethod.GET)
    public ModelAndView welcomePage() {
        ModelAndView model = new ModelAndView();
        model.addobject(“title“ “Spring Security Hello World“);
        model.addobject(“message“ “This is welcome page!“);
        model.setViewName(“hello“);
        return model;
    }

    /**
     * 返回 admin 视图
     *
     * @return
     */
    @RequestMapping(value = “/admin**“ method = RequestMethod.GET)
    public ModelAndView adminPage() {
        ModelAndView model = new ModelAndView();
        model.addobject(“title“ “Spring Security Hello World“);
        model.addobject(“message“ “This is protected page!“);
        model.setViewName(“admin“);
        return model;
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-10-14 21:54  spring-security-basic\
     目录           0  2018-10-15 20:09  spring-security-basic\.idea\
     文件         554  2018-10-15 19:46  spring-security-basic\.idea\compiler.xml
     文件         177  2018-10-14 20:41  spring-security-basic\.idea\encodings.xml
     文件         672  2018-10-14 20:52  spring-security-basic\.idea\misc.xml
     文件       25750  2018-10-15 20:09  spring-security-basic\.idea\workspace.xml
     文件        6185  2018-10-14 21:51  spring-security-basic\pom.xml
     文件          81  2018-10-14 20:38  spring-security-basic\spring-security-basic.iml
     目录           0  2018-10-14 20:39  spring-security-basic\src\
     目录           0  2018-10-14 20:43  spring-security-basic\src\main\
     目录           0  2018-10-14 20:50  spring-security-basic\src\main\java\
     目录           0  2018-10-14 20:50  spring-security-basic\src\main\java\demo\
     目录           0  2018-10-14 20:50  spring-security-basic\src\main\java\demo\spring\
     目录           0  2018-10-14 20:50  spring-security-basic\src\main\java\demo\spring\security\
     目录           0  2018-10-14 20:50  spring-security-basic\src\main\java\demo\spring\security\hello\
     目录           0  2018-10-14 21:04  spring-security-basic\src\main\java\demo\spring\security\hello\controller\
     文件        1220  2018-10-14 21:04  spring-security-basic\src\main\java\demo\spring\security\hello\controller\HelloWorldController.java
     目录           0  2018-10-14 21:03  spring-security-basic\src\main\resources\
     文件        1463  2018-10-14 21:03  spring-security-basic\src\main\resources\application-mvc.xml
     文件         881  2018-10-14 21:03  spring-security-basic\src\main\resources\application-security.xml
     文件         413  2018-10-14 21:02  spring-security-basic\src\main\resources\application.xml
     目录           0  2018-10-14 20:46  spring-security-basic\src\main\webapp\
     文件          52  2018-10-14 20:39  spring-security-basic\src\main\webapp\index.jsp
     目录           0  2018-10-14 20:59  spring-security-basic\src\main\webapp\WEB-INF\
     目录           0  2018-10-14 20:55  spring-security-basic\src\main\webapp\WEB-INF\pages\
     文件         500  2018-10-14 20:53  spring-security-basic\src\main\webapp\WEB-INF\pages\admin.jsp
     文件         234  2018-10-14 20:55  spring-security-basic\src\main\webapp\WEB-INF\pages\hello.jsp
     文件        2103  2018-10-14 20:59  spring-security-basic\src\main\webapp\WEB-INF\web.xml
     目录           0  2018-10-15 20:06  spring-security-basic\target\
     目录           0  2018-10-15 19:55  spring-security-basic\target\apache-tomcat-maven-plugin\
     目录           0  2018-10-15 19:51  spring-security-basic\target\classes\
............此处省略104个文件信息

评论

共有 条评论