1、@ConfigurationProperties爆红并报以下错误
Field person in com.yingtao.boot.controller.Hellocontroller required a bean of type 'com.yingtao.boot.beans.Person' that could not be found.
必须在前面加上@Component
2、新建spring iniz项目时,需要选择版本为8的,而不是17!!!
3、如果报这个错误:
则需要在pom里面加入这个就行
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
4、配置数据库文件appliction的时候,:后面要空一位!!!
spring:
datasource:
url: jdbc:mysql://localhost:3306/book?characterEncoding=utf-8&serverTimezone=UTC
username: root
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
5、springboot 整合rabbitmq时,出现java.net.SocketException: Socket Closed错误,是因为host设置的是localhost域名,而mq通讯通过ip物理地址所以要改成127.0.0.1。
6、docker创建rabbitmq容器:
docker run -d --hostname alex --name rabbitmq -e RABBITMQ_DEFAULT_USER=guest -e RABBITMQ_DEFAULT_PASS=guest -p 15672:15672 -p 5672:5672 c20