20240409报错修改学习
未配置Spring Boot 配置注解处理器
spring:
datasource:
druid:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/mini_springmvc?serverTimezone=UTC
username: root
password: 1234
mybatis-plus:
global-config:
db-config:
table-prefix: tb_
id_type: auto
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# int,value(String),uuid(String),long(long,可以存时间)
testcase:
book:
id: ${random.int(90900,10000)}
name: ${random.value}
type: ${random.value}
description: 描述${random.value}
package com.lmcode.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Component
// 未配置Spring Boot 配置注解处理器
@ConfigurationProperties(prefix = "testcase.book")
public class Book {
private Integer id;
private String name;
private String type;
private String description;
}
解决:
<!--配置Spring Boot 配置注解处理器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
mybatisPlus表名不匹配
如果表名不匹配可以在实体类添加@TableName("")