1.使用@ConfigurationProperties注解时出现异常
spring boot Configuration Annotation Proessor not found in classpath
解决方案:maven添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
2.使用SpringJPA操作数据库
org.springframework.dao.InvalidDataAccessResourceUsageException: error performing isolated work; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: error performing isolated work
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'ordersell.hibernate_sequence' doesn't exist
原因:唯一标识缺少注解 @GeneratedValue(strategy = GenerationType.IDENTITY)
方案:正确方式为:
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer categoryId;