随笔分类 -  SpringBoot

1 2 下一页

springboot集成shiro
摘要:spring集成shiro https://blog.csdn.net/qq877728715/article/details/109543674 阅读全文

posted @ 2023-08-09 09:33 companion 阅读(14) 评论(0) 推荐(0)

27-springboot-thymeleaf内置对象
摘要:1、内置web对象 thymaleaf内置的web对象,可以直接在模板中使用,这些对象由#号开头: #request: 相当于HttpServletRequest 对象,这是Thymeleaf 3.x版本,若是Thymeleaf 2.x版本使用 #httpServletRequest; ${#req 阅读全文

posted @ 2023-04-03 16:24 companion 阅读(272) 评论(0) 推荐(0)

26-springboot-thymeleaf字符串拼接-常量-符号
摘要:Thymeleaf 字符串拼接 一种是字符串拼接: <span th:text="'当前是第'+${sex}+'页 ,共'+${sex}+'页'"></span> 另一种更简洁的方式,使用“|”减少了字符串的拼接: <span th:text="|当前是第${sex}页,共${sex}页|"></s 阅读全文

posted @ 2023-04-03 16:23 companion 阅读(417) 评论(0) 推荐(0)

25-springboot-thymeleaf的常见属性
摘要:th:action <form id="login" th:action="@{/login}">......</form> th:method <form id="login" th:action="@{/login}" th:method="post">......</form> th:href 阅读全文

posted @ 2023-04-03 16:04 companion 阅读(55) 评论(0) 推荐(0)

24-springboot-thymeleaf的表达式
摘要:1.添加热部署,为了测试不用频繁重启 <!--热部署插件--><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</ 阅读全文

posted @ 2023-04-03 16:02 companion 阅读(24) 评论(0) 推荐(0)

23-springboot集成thymeleaf
摘要:Spring Boot 官方推荐前端不使用JSP,推荐使用thymeleaf来替代JSP技术; Thymeleaf是一种模板技术,该模板技术也采用Java语言开发的; 但是thymeleaf是另外一家公司开源做的,并不属于springboot,springboot只是很好地集成这种模板技术,作为前端 阅读全文

posted @ 2023-04-03 15:20 companion 阅读(93) 评论(0) 推荐(0)

22-springboot应用监控-actuator
摘要:可以做成页面监控(springboot-admin),而不是json的格式,看起来会更方便。 在生产环境中,有时可能需要监控服务的可用性,spring-boot 的 actuator 就是提供了对应用的配置查看、健康检查、相关功能统计等,可以通过HTTP,JMX来访问这些监控功能;(端点) 如何使用 阅读全文

posted @ 2023-04-03 14:40 companion 阅读(164) 评论(0) 推荐(0)

21-springboot为什么不推荐使用jsp
摘要:参考文章及实现方式 https://www.zhihu.com/question/61385975 阅读全文

posted @ 2023-04-03 13:49 companion 阅读(21) 评论(0) 推荐(0)

20-springboot打包部署
摘要:1.打war包 1. 程序入口类需扩展继承 SpringBootServletInitializer 类 2、程序入口类覆盖如下方法: @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder ap 阅读全文

posted @ 2023-04-03 11:09 companion 阅读(64) 评论(0) 推荐(0)

19-springboot自动配置原理
摘要:SpringBoot自动配置原理(SpringBoot自动装配原理,SpringBoot starter原理) SpringBoot可以根据定义在classpath下的类,自动的给你生成一些Bean,并加载到Spring的Context中,自动配置充分的利用了Spring 4.0的条件化配置特性,能 阅读全文

posted @ 2023-03-28 17:42 companion 阅读(105) 评论(0) 推荐(0)

18-springboot集成dubbo
摘要:第一步:添加依赖; 第二步:配置application.properties文件; 第三步:编写代码,可能用到一些注解; 1、添加依赖: 可不用注册中心直接调用或者zookeeper或者nacos作为注册中心 <!-- dubbo-spring-boot-starter dubbo提供 --><de 阅读全文

posted @ 2023-03-27 13:34 companion 阅读(53) 评论(0) 推荐(0)

17-springboot整合第三方框架三部曲
摘要:一个规律,那就是springboot整合第三方框架或组件,都是通过三步来完成: 第一步:添加依赖; 第二步:配置application.properties文件; 第三步:编写代码,可能用到一些注解; 阅读全文

posted @ 2023-03-24 16:23 companion 阅读(59) 评论(0) 推荐(0)

16-springboot关于输出日志的修改
摘要:关闭spring logo图标 日志输出: SpringApplication springApplication = new SpringApplication(SpringBootConsoleApplication.class); springApplication.setBannerMode 阅读全文

posted @ 2023-03-24 16:20 companion 阅读(51) 评论(0) 推荐(0)

15-springboot创建非web应用
摘要:在 Spring Boot 框架中,要创建一个非Web应用程序(纯Java程序): 方式一: 1、SpringBoot开发纯Java程序,应该采用如下的起步依赖: <!-- Springboot开发java项目的起步依赖 --> <dependency> <groupId>org.springfra 阅读全文

posted @ 2023-03-24 16:20 companion 阅读(375) 评论(0) 推荐(0)

14-springboot配置文件
摘要:1、.properties文件 键值对的properties属性文件配置方式 SpringBoot默认读取该文件作为项目配置文件 2、.yml文件 yml 也是一种配置文件格式,主要采用空格、换行、冒号等格式排版进行配置; yml 后缀也可以使用 yaml 后缀; 配置的值与前面的冒号必须要有一个空 阅读全文

posted @ 2023-03-24 15:35 companion 阅读(39) 评论(0) 推荐(0)

13-springboot集成Redis
摘要:Spring boot 集成 Redis 的步骤如下: 1、在pom.xml中配置相关的jar依赖; <!-- 加载spring boot redis包 --><dependency> <groupId>org.springframework.boot</groupId> <artifactId>s 阅读全文

posted @ 2023-03-23 16:09 companion 阅读(55) 评论(0) 推荐(0)

12-springboot集成Swagger
摘要:Swagger2 的作用: 随项目自动生成强大RESTful API文档,减少工作量;(不需要自己写api文档了) API文档与代码整合在一起,便于同步更新API文档的说明; 页面测试功能来调试每个RESTful API; 怎么集成? 1、添加相关依赖 <!-- springfox-swagger2 阅读全文

posted @ 2023-03-23 11:23 companion 阅读(31) 评论(0) 推荐(0)

11-springboot静态资源访问
摘要:静态资源:js, css, html, 图片,音视频等; 静态资源路径:是指系统可以直接访问的路径,且路径下的所有文件均可被用户直接访问; Spring Boot默认静态资源目录位置位于classpath下,目录名需符合如下规则: /static /public /META-INF/resource 阅读全文

posted @ 2023-03-23 10:46 companion 阅读(41) 评论(0) 推荐(0)

10-springboot统一处理404错误
摘要:404不是异常,是找不到的情况 当输入地址有误,会进入springboot默认的白板404页面,对用户不太友好,我们可以统一定义一个全局的404错误处理; @Beanpublic WebServerFactoryCustomizer<ConfigurableWebServerFactory> web 阅读全文

posted @ 2023-03-23 10:41 companion 阅读(352) 评论(0) 推荐(0)

9-springboot统一异常处理
摘要:500错误页面之前可以xml中配置errorpage的配置,或者tomcat的web.xml中处理,现在可以进行统一处理。 新建处理类统一处理 @ControllerAdvice -> 如果改成RestControllerAdvice 那么里面的方法就不用加@ResponseBody的内容,但是只能 阅读全文

posted @ 2023-03-22 17:41 companion 阅读(45) 评论(0) 推荐(0)

1 2 下一页