springboot的yml配置文件绑定时必须和相应的类中的属性类型对应,不然启动报错
今天启动springboot应用时一开始一直是error,访问localhost也无法打开:
此时自己的Person.java:
package boot.bean;
import lombok.Data;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import java.util.*;@ConfigurationProperties(prefix = "person")
@Component
@ToString
@Data
public class Person {private String userName;private Boolean boss;private Date birth;private Pet pet;private String [] interest;private List<String> animal;private Set<Double>salary;private Map<String, Object>scores;private Map<String, List<Pet>> allpets;
}
properties.yml:
person:userName: zhangsanboss: Truebirth: 2019/12/9interest:- 篮球- 足球- 18scores:english: 90math: 99animal: [阿猫,阿狗]salary:- 32452.2- 2522.3pet:name: 阿狗age: 4allpets:sick:- {name: 猫咪,age: 1}- {name: 小兔子,age: 2}health: [{name: 小丑,age: 1 },{name: 小王,age: 34}]
然后有显示 allpets这一行的数据有问题,于是注释掉以后:
重新启动:
Tomcat started on port(s): 8081 (http) with
由于设置的是8081端口,于是打开8081:
注意:在yml文件中数据的表示可以不用单引号双引号表示,
如果application.properties和application.yml文件同时配置,优先级是properties文件更高(更先读)
springboot的yml配置文件绑定时必须和相应的类中的属性类型对应,不然启动报错相关推荐
- 解决高版本SpringBoot整合swagger时启动报错:Failed to start bean ‘documentationPluginsBootstrapper‘ 问题
一.控制台的报错信息 2021-12-29 15:15:04 [main] ERROR org.springframework.boot.SpringApplication - Application ...
- Springboot 集成 Activiti时启动报错!'org.activiti.spring.boot.SecurityAutoConfiguration
Springboot 集成 Activiti时启动报错! org.springframework.beans.factory.BeanCreationException: Error creating ...
- SpringBoot启动报错Could not resolve placeholder ‘XXX.XXX‘ in value
SpringBoot启动项目时报错: Exception encountered during context initialization - cancelling refresh attempt: ...
- springboot项目启动报错-案例情景介绍
文章目录 摘要 情况1:Nacos报错 情况2:IllegalStateException: Incompatible fallbackFactory instance 情况3:idea编译java文 ...
- SpringBoot启动报错:HikariPool-1 - Exception during pool initialization.解决办法
SpringBoot启动报错:HikariPool-1 - Exception during pool initialization. 记一次Maven项目部署http访问mysql数据库过程中的问题 ...
- springboot启动报错:Unregistering JMX-exposed beans on shutdown
环境 1,maven 3.5.0 2,eclipse 4.7.1 3,spring boot 1.5.9.RELEASE springboot启动报错 按照spring 用户手册创建新的spring ...
- SpringBoot启动报错:Parameter 0 of method hmset in com.qcby.rbac.util.RedisUtils required a bean of type
SpringBoot启动报错,报错信息如下: 报错是由于A类中定义了含参数的构造函数,Spring自动构造和注入时未为该Bean传入参数,引起报错. 查了很多资料,最后发现,我是因为注释的时候没有把@ ...
- 应用时间线服务器启动报错_从服务器到无服务器的时间轴和教程
应用时间线服务器启动报错 Amazon Web Services is a behemoth powering companies from Fortune 500 corporations to h ...
- 启动Spring项目报错,Springboot启动报错 Disconnected from the target VM 解决过程
启动Spring项目报错,Springboot启动报错 Disconnected from the target VM 解决过程 大概率是缺少了一下依赖 <dependency><g ...
最新文章
- 逻辑结构图向关系转换规则3
- mysql怎么维护_Navicat for MySQL 如何管理和维护表
- MySQL删除普通用户
- 【视频课】8大Pytorch CV实践案例,超30小时视频助你攻略CV三大基础任务(分类分割检测)
- linux系统相关硬件查询
- oracle12154错误 Linux,关于“EXP-00056: ORACLE error 12154 encountered”的解决方法
- 服务降级,服务熔断,服务限流
- 数据可视化(三)- Seaborn简易入门
- sklearn自学指南(part29)--高斯混合模型
- 玩转MySQL之Linux下的简单操作(服务启动与关闭、启动与关闭、查看版本)
- android 使用AIDL实现进程间通讯
- 前向传播、反向传播——通俗易懂
- 安卓案例:初试谷歌图表
- 设置最小值_WELSIM中设置有限元计算结果的最大最小值
- 基于jQuery UI CSS Framework开发Widget
- 汽车制动能量回收系统仿真模型
- 【UTM使用_入侵防御策略】
- c语言的area的用法,area的用法说明
- LLVM IRBuilder and pass:1.llvm基础命令
- 优漫动游:带你了解UI图片比例技巧
热门文章
- win7降低屏幕亮度_深度解析:Redmi K20 Pro 第七代屏幕指纹技术
- 风变python基础语法第11关_Python基础语法学习笔记之风变第十四关项目实操
- 战神背光键盘如何关系_4000元学生办公游戏本该如何选择?
- android 外键,android - 创建一个具有外键的sqlite数据库表,作为android中的表列。 我面临以下错误。 我该如何解决 - 堆栈内存溢出...
- php程序计算偶数和,php怎么编写计算双数的和
- 网站使用mysql_使用网站的mysql
- 分布式内存数据库---Redis的持久化
- leetcode复习1
- 今晚被两个bug 困扰---第一个,小程序数组传递到PHP后台变成了字符串,导致解析失败
- ACL 2018 论文解读 | 基于深度强化学习的远程监督关系抽取