工做中使用SpringBoot出现的问题

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;
相关文章
相关标签/搜索