基于内存方式 - 只作学习参考1.引入依赖<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>2.login.html、index.html、fail.htmllogin.html:<form method="post" action="/doLogin">用户名:<input id="username" name="username" type="text" />密码:<input id="password" name="password" type="password"/><input type="submit" value="登录"/> </form>index.html:<h3><font color="#228b22">恭喜您,登录成功!</font></h3>fail.html:<h3><font color="#dc143c">很抱歉,登录失败!</font></h3>