Spring 引导 创建名称'h2Console'类路径资源中定义的 Bean 时出错



我正在尝试使用postgresql,但我遇到了这个错误。这是我的应用程序属性

server.port=8081
application.name= = Address Registration
application.version = 1.0.0
spring.datasource.url= jdbc:postgresql://localhost:5432/addressRegistration
spring.datasource.username= postgres
spring.datasource.password= 12345
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation= true
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.PostgreSQLDialect
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto= update

当spring注册完成程序执行所需的bean时,在上下文加载期间可能会发生这种情况。可以检查的选项很少。

  1. pom.xml中缺少对h2数据库的依赖。因此,没有在类路径中下载jar
  2. 自动配置搞砸了。你可以试试@EnableAutoConfiguration( exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
  3. 您的app.properties中可能还有一些关于h2数据库的设置,但是您不想使用h2数据库

最新更新