
spring boot
鲸落ж
出社会2年,呜呜呜呜
展开
-
Request cannot be executed; I/O reactor status: STOPPED] with root cause
ElasticSearch:Request cannot be executed; I/O reactor status: STOPPED 错误记录 报错中status是STOPPED,也就是被关闭了,大概率是业务程序中多个线程共享restclient,某个线程调用完restclient后关闭了,导致其他线程再去发送请求时报错。 在我的代码中: SearchResponse searchResponse = restHighLevelClient.search(jd_goods, RequestOption原创 2021-09-04 23:11:06 · 2208 阅读 · 5 评论 -
This may be the result of an unspecified view, due to default view name generation.
在通过控制类访问页面时,报下面的错误: This may be the result of an unspecified view, due to default view name generation. 在springboot中添加,就可以了 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf&l原创 2021-09-04 20:46:03 · 642 阅读 · 0 评论 -
多环境配置
多环境配置 配置文件的加载位置 官方说明配置文件优先级: springboot 启动会扫描以下位置的application.properties或者application.yml文件作为Spring boot的默认配置文件: 优先级1:项目路径下的config文件夹配置文件 优先级2:项目路径下配置文件 优先级3:资源路径下的config文件夹配置文件 优先级4:资源路径下配置文件 高优先级的配置会覆盖低优先级的配置。springboot会从全部加载主配置文件,互补配置 多环境切换 profil原创 2021-08-24 20:21:28 · 132 阅读 · 0 评论 -
JSR303校验
JSR303校验 Springboot中可以用@validated来校验数据,如果数据异常则会统一抛出异常,方便异常中心统一处理。我们这里来写个注解让我们的name只能支持Email格式; @Component //注册bean @ConfigurationProperties(prefix = "person") @Validated //数据校验 public class Person { @Email(message="邮箱格式错误") //name必须是邮箱格式 private原创 2021-08-24 20:03:15 · 222 阅读 · 0 评论 -
Yml语法
Yml语法 yml语法概述 SpringBoot使用的是一个全局配置文件,配置文件名是固定的。 application.properties ----->key=value application.yml---------------->key: value YAML是 "YAML Ain’t a Markup Language (YAML不是一种标记语言)的递归缩写。在开发的这种语言时,YAML 的意思其实是:“Yet Another Markup Language”(仍是一种标记语言)原创 2021-08-24 19:49:21 · 832 阅读 · 0 评论 -
spring boot之------helloword
准备工作 1.环境 java version “1.8.0_181” Maven-3.6.1 SpringBoot 2.x 最新版 2.开发环境 IDEA 项目构建 1.项目结构 2.HelloWorld代码 package com.ren.helloworld.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annot原创 2021-08-19 20:42:18 · 110 阅读 · 0 评论