Java 无法获取spring引导以在gradle项目中自动创建数据库架构
我已经完成了与Java 无法获取spring引导以在gradle项目中自动创建数据库架构,java,spring,spring-boot,Java,Spring,Spring Boot,我已经完成了与application.yml文件中所有数据库相关的设置,但是日志中没有可见的数据库创建消息,并且在调用实际api时生成了与数据库表相关的错误 application.yml server: port: 8080 spring: datasource: drive-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/sys?serverTimezone=UTC
application.yml
文件中所有数据库相关的设置,但是日志中没有可见的数据库创建消息,并且在调用实际api时生成了与数据库表相关的错误
application.yml
server:
port: 8080
spring:
datasource:
drive-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/sys?serverTimezone=UTC&characterEncoding=UTF-8
username: root
password: ####
jpa:
database: mysql
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
general-ddl: true
show-sql: true
hibernate:
format_sql: true
ddl-auto: create
security:
oauth:
authorization:
check-token-access: isAuthenticated()
oauth2:
jwt:
signkey: 123@#$
Application.java:
@EnableAutoConfiguration
@SpringBoot应用程序
@EnableConfigurationProperties
@EntityScan(basePackages={“com.springboard.backend”})
公共类应用程序{
公共静态void main(字符串[]args){
SpringApplication.run(Application.class,args);
}
}
Users.java
@Getter
@塞特
@实体
@托斯特林
@建筑商
@诺尔格构装师
@AllArgsConstructor
@EqualsAndHashCode(of=“uid”)
公共类用户实现UserDetails{
@身份证
@GeneratedValue(策略=GenerationType.IDENTITY)
@列(唯一=真)
私有整数id;
@纵队
私有字符串用户名;
@纵队
私有字符串电话号码;
@纵队
私有字符串地址;
@纵队
私有字符串地址2;
公共布尔isAddress(字符串地址){
返回地址=”우리집";
}
@OneToMany(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
@JoinColumn(name=“user\u id”)
@ElementCollection(fetch=FetchType.EAGER)
private List userRoles=new ArrayList();
@凌驾
公共收藏您的配置似乎不正确。请确保jpa
位于spring
下:
spring:
jpa:
database: mysql
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
general-ddl: true
show-sql: true
hibernate:
format_sql: true
ddl-auto: create
我尝试了这个方法,但是通过JDBC语句执行DDL“alter table user_role drop外键FKj345gk1bovqvfame88rcx7yyx”时出现了错误错误,然后您能看到这个问题吗??