与DB的连接卡住了弹簧启动jpa



当我构建项目时,它卡在HikariPool-1上-正在启动。。。

这里是完整的堆栈:

.   ____          _            __ _ _
/\ / ___'_ __ _ _(_)_ __  __ _    
( ( )___ | '_ | '_| | '_ / _` |    
\/  ___)| |_)| | | | | || (_| |  ) ) ) )
'  |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: 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:UsersadminIdeaProjectslessonwizbuildclassesjavamain starte
d by admin in C:UsersadminIdeaProjectslessonwiz)
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.

build.gradle

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

pg面板:屏幕截图

谢谢你的回答

尝试更改application.properties中的这些行。

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