通过datasourcenull(和其他一些)连接

问题描述 投票:0回答:1

我正在使用 Spring Boot 3.4.0(快照)、Maven、Java 22。我还使用 PostgreSQL。

这是我的application.properties数据:

应用程序.属性

spring.application.name=api
spring.datasource.url = jdbc:postgresql://localhost:5432/my_database?verifyServerCertificate=false&useSSL=false&requireSSL=false
spring.datasource.username = root
spring.datasource.password = password
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=validate`

当我运行项目时,出现此错误:

Database JDBC URL [Connecting through datasourcenull]
Database driver: undefined/unknown
Database version: 16.4
Autocommit mode: undefined/unknown
Isolation level: undefined/unknown
Minimum pool size: undefined/unknown
Maximum pool size: undefined/unknown

但其他一切似乎都运行良好。这是完整的消息:

Scanning for projects...

---------------------------< com.stiven:api >---------------------------
Building api 0.0.1-SNAPSHOT
  from pom.xml
--------------------------------[ jar ]---------------------------------

--- resources:3.3.1:resources (default-resources) @ api ---
Copying 1 resource from src/main/resources to target/classes
Copying 0 resource from src/main/resources to target/classes

--- compiler:3.13.0:compile (default-compile) @ api ---
Nothing to compile - all classes are up to date.

--- exec:3.1.0:exec (default-cli) @ api ---

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::       (v3.4.0-SNAPSHOT)

2024-09-07T22:14:37.723-04:00  INFO 117983 --- [api] [           main] com.stiven.api.ApiApplication            : Starting ApiApplication using Java 22.0.1 with PID 117983 (/home/stiven-guillermo-bueno-reynoso/Documents/FarmacyAPI/target/classes started by stiven-guillermo-bueno-reynoso in /home/stiven-guillermo-bueno-reynoso/Documents/FarmacyAPI)
2024-09-07T22:14:37.736-04:00  INFO 117983 --- [api] [           main] com.stiven.api.ApiApplication            : No active profile set, falling back to 1 default profile: "default"
2024-09-07T22:14:39.355-04:00  INFO 117983 --- [api] [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2024-09-07T22:14:39.495-04:00  INFO 117983 --- [api] [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 120 ms. Found 1 JPA repository interface.
2024-09-07T22:14:40.524-04:00  INFO 117983 --- [api] [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2024-09-07T22:14:40.556-04:00  INFO 117983 --- [api] [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-09-07T22:14:40.557-04:00  INFO 117983 --- [api] [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.28]
2024-09-07T22:14:40.662-04:00  INFO 117983 --- [api] [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-09-07T22:14:40.664-04:00  INFO 117983 --- [api] [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2816 ms
2024-09-07T22:14:40.960-04:00  INFO 117983 --- [api] [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2024-09-07T22:14:41.040-04:00  INFO 117983 --- [api] [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 6.6.0.Final
2024-09-07T22:14:41.099-04:00  INFO 117983 --- [api] [           main] o.h.c.internal.RegionFactoryInitiator    : HHH000026: Second-level cache disabled
2024-09-07T22:14:41.739-04:00  INFO 117983 --- [api] [           main] o.s.o.j.p.SpringPersistenceUnitInfo      : No LoadTimeWeaver setup: ignoring JPA class transformer
2024-09-07T22:14:41.791-04:00  INFO 117983 --- [api] [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2024-09-07T22:14:42.504-04:00  INFO 117983 --- [api] [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@5cdf221a
2024-09-07T22:14:42.507-04:00  INFO 117983 --- [api] [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2024-09-07T22:14:42.546-04:00  WARN 117983 --- [api] [           main] org.hibernate.orm.deprecation            : HHH90000025: PostgreSQLDialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)
2024-09-07T22:14:42.573-04:00  INFO 117983 --- [api] [           main] org.hibernate.orm.connections.pooling    : HHH10001005: Database info:
    Database JDBC URL [Connecting through datasourcenull]
    Database driver: undefined/unknown
    Database version: 16.4
    Autocommit mode: undefined/unknown
    Isolation level: undefined/unknown
    Minimum pool size: undefined/unknown
    Maximum pool size: undefined/unknown
2024-09-07T22:14:44.689-04:00  INFO 117983 --- [api] [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
2024-09-07T22:14:44.802-04:00  INFO 117983 --- [api] [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2024-09-07T22:14:45.223-04:00  INFO 117983 --- [api] [           main] o.s.d.j.r.query.QueryEnhancerFactory     : Hibernate is in classpath; If applicable, HQL parser will be used.
2024-09-07T22:14:45.324-04:00  WARN 117983 --- [api] [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2024-09-07T22:14:46.025-04:00  INFO 117983 --- [api] [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port 8080 (http) with context path '/'
2024-09-07T22:14:46.046-04:00  INFO 117983 --- [api] [           main] com.stiven.api.ApiApplication            : Started ApiApplication in 9.314 seconds (process running for 9.87)

我尝试更改

application.properties
,例如
spring.jpa.hibernate.ddl-auto
spring.jpa.database-platform
spring.datasource.driver-class-name
,但没有任何效果。有人知道会发生什么吗?

java spring postgresql spring-boot jpa
1个回答
0
投票

我在新版本的 Spring boot 3.4.0 中也有同样的通知。您可能需要修复 application.properties 中的 hikari 设置,以便它们正确应用,但我在任何地方都没有找到有关此内容的任何信息。

© www.soinside.com 2019 - 2024. All rights reserved.