Java 与DB卡滞弹簧启动jpa的连接

Java 与DB卡滞弹簧启动jpa的连接,java,database,spring-boot,hibernate,jpa,Java,Database,Spring Boot,Hibernate,Jpa,当我建立项目时,它会在Hikariool-1上阻塞-开始 以下是完整的stacktrace: . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / /

当我建立项目时,它会在Hikariool-1上阻塞-开始

以下是完整的stacktrace:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.3.5.RELEASE)

2020-11-16 19:25:53.132  INFO 5328 --- [  restartedMain] pl.umcs.lessonwiz.LessonwizApplication   : Starting LessonwizApplication on DESKTOP-4VPS8T4 with PID 5328 (C:\Users\admin\IdeaProjects\lessonwiz\build\classes\java\main starte
d by admin in C:\Users\admin\IdeaProjects\lessonwiz)
2020-11-16 19:25:53.135  INFO 5328 --- [  restartedMain] pl.umcs.lessonwiz.LessonwizApplication   : No active profile set, falling back to default profiles: default
2020-11-16 19:25:53.180  INFO 5328 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-11-16 19:25:53.180  INFO 5328 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-11-16 19:25:53.688  INFO 5328 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-11-16 19:25:53.706  INFO 5328 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 11ms. Found 0 JPA repository interfaces.
2020-11-16 19:25:54.242  INFO 5328 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-11-16 19:25:54.256  INFO 5328 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-11-16 19:25:54.257  INFO 5328 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.39]
2020-11-16 19:25:54.351  INFO 5328 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-11-16 19:25:54.352  INFO 5328 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1172 ms
2020-11-16 19:25:54.434  INFO 5328 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
调试时,我在一个循环中收到3条消息:

2020-11-16T19:36:12.936+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
2020-11-16T19:36:12.936+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
2020-11-16T19:36:12.936+0100 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
格雷德尔先生

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    compile group: 'org.postgresql', name: 'postgresql', version: '42.2.18'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    compileOnly 'org.projectlombok:lombok:1.18.16'
    annotationProcessor 'org.projectlombok:lombok:1.18.16'

    testCompileOnly 'org.projectlombok:lombok:1.18.16'
    testAnnotationProcessor 'org.projectlombok:lombok:1.18.16'
}
application.properties:

spring.output.ansi.enabled=ALWAYS
spring.datasource.url=jdbc:postgresql://127.0.0.1:49888/postgres/postgres
spring.datasource.username=postgres
spring.datasource.password=kurwa123
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=create
专家组:


感谢您的回答

请尝试在
应用程序.properties
中更改这些行

spring.datasource.url=jdbc:postgresql://127.0.0.1:5432/postgres

您的
spring.datasource.url
中似乎有太多的
postgres
条目。您的
spring.datasource.url
是否应该在最后只有一个
postgres
?同样的情况,我只是为了测试而尝试了这个方法。如果您将端口号更改为您知道postgres没有运行的某个随机端口,是否会出现
连接被拒绝
错误或类似的其他错误?同样的情况,谢谢,问题解决了,我正在管理控制台使用的端口上运行应用程序