我有一个spring项目连接到postgresql数据库。该连接在以下application.yml
文件中定义:
spring:
datasource: #TODO replace application.yml with an xml or java config file
url: jdbc:${DBURL} #localhost/taskorchard
username: ${DBUSER}
password: ${DBPASSWORD}
tomcat:
max-wait: 20000
max-active: 50
max-idle: 20
min-idle: 15
jpa:
hibernate:
ddl-auto: none
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
id:
new_generator_mappings: false
jdbc:
lob:
non_contextual_creation: true
server:
port: 8080 # This is the default port anyway, but you can change it here
security:
jwt:
token:
secret-key: secret-key
expire-length: 300000 # 5 minutes duration by default: 5 minutes * 60 seconds * 1000 miliseconds
UserController:
signin: Authenticates user and returns its JWT token.
signup: Creates user and returns its JWT token
delete: Deletes specific user by username
search: Returns specific user by username
me: Returns current user's data
请注意,方言为org.hibernate.dialect.PostgreSQLDialect
,ddl-auto
设置为none
。
但是当我运行这个程序时,我在我的运行窗口中看到以下内容:
2019-10-26 16:20:15.021 INFO 3320 ... Using dialect: org.hibernate.dialect.H2Dialect
并得到错误:
2019-10-26 16:20:15.761 WARN 3320 ... Error executing DDL "create table toevent ...
因此,即使ddl-auto
设置为none
,它也使用了错误的方言并执行了一个ddl命令。
我认为在我的资源文件夹中找到application.yml可能有困难,因为我正在摆弄我的源文件夹来设置测试源文件夹,但我仍然将资源文件夹设置为正确的内容,如下面的图片所示:
目录结构:
内容根:
但我担心之前没有的部分目录结构后面的绿色高亮显示。
到底怎么回事?如何让ddl-auto
和方言按其应有的方式工作?
发布于 2019-10-27 05:13:43
嗯,我更新了intellij,这个问题已经解决了。不知道到底出了什么问题。我猜intellij只是糊涂了?
https://stackoverflow.com/questions/58574517
复制相似问题