随笔分类 - spring boot
摘要:登录拦截器功能:开发一个系统时,系统需要登录后才能进行各种访问。如果没有登录,则没有权限进行访问,拦截器将拦截访问请求,跳转到登录页面提示用户进行登录。 编写一个拦截器实现handlerInterceptor接口 @Slf4j public class LoginInterceptor implem
阅读全文
摘要:官方文档: https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#standard-expression-syntax 使用时需要为html添加属性: <html xmlns:th="http://www.thymeleaf.
阅读全文
摘要:导入依赖 方法一:创建项目时导入Thyme leaf的依赖(常用) 方法二:了解 找到支持的thyme leaf版本,在Thymeleaf官网或GitHub导入此版本的依赖 <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thyme
阅读全文
摘要:private Resource getIndexHtml(String location) { return this.getIndexHtml(this.resourceLoader.getResource(location)); } private Resource getIndexHtml(
阅读全文
摘要:WebMvcAutoConfiguration.class WebMvcAutoConfiguration下的WebMvcAutoConfigurationAdapter中有addResourceHandlers方法 public void addResourceHandlers(ResourceH
阅读全文
摘要:spring官方推荐使用application.yaml代替application.properties,因为yaml更加强大 properties语法:key=value ,例如 server.port=8080 yaml语法:key:空格value,例如 server: port: 8080 y
阅读全文
摘要:主程序 @SpringBootApplication //SpringBootApplication 标注这个类是一个spring boot的应用 @SpringBootApplication public class HelloApplication { //将spring boot启动 publ
阅读全文