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;