programing

spring jpa application.properties 사용SSL

jooyons 2023. 6. 19. 21:27
반응형

spring jpa application.properties 사용SSL

로컬 mysql 데이터베이스에서 SSL을 끄려고 합니다.그러나 springapplication.properties 파일에서 이 작업을 수행할 실제 속성을 찾을 수 없습니다.

현재 파일:

# ===============================
# = DATA SOURCE
# ===============================

# Set here configurations for the database connection

# Connection url for the database "test"
spring.datasource.url = jdbc:mysql://localhost:3306/test
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

# Username and password
spring.datasource.username = root
spring.datasource.password = blah

# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1

# ===============================
# = JPA / HIBERNATE
# ===============================

# Use spring.jpa.properties.* for Hibernate native properties (the prefix is
# stripped before adding them to the entity manager).

# Show or not log for each sql query
spring.jpa.show-sql = true

# Hibernate ddl auto (create, create-drop, update): with "update" the database
# schema will be automatically updated accordingly to java entities found in
# the project
spring.jpa.hibernate.ddl-auto = update

# Naming strategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy

# Allows Hibernate to generate SQL optimized for a particular DBMS
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

난 시도했다.spring.datasource.useSSl=false그리고 그것은 작동하지 않습니다.저도 노력했습니다.spring.datasource.url = jdbc:mysql://localhost:3306/test&useSSL=false

다음과 같은 문제를 해결했습니다.

jdbc:mysql://localhost:3306/test?verifyServerCertificate=false&useSSL=false&requireSSL=false

'&' 대신 '?'를 사용해야 하는 거 아닙니까?

이것은 너의 것이다.

spring.datasource.url =jdbc:mysql://localhost:3306/test&useSSL=false

내 말은

spring.datasource.url = jdbc:mysql://localhost:3306/test?useSSL=false

저는 오염시키는 것을 좋아하지 않습니다.java어떤 경우에도 응용프로그램 컨테이너에서 쓸모없는 옵션 또는 시스템 속성...

다음을 사용하여 MySQL 연결에 대한 SSL 인증서를 프로그래밍 방식으로 설정할 수 있습니다.

jdbc:http://example.com:3306/MYDB?verifyServerCertificate=true&useSSL=true&requireSSL=true&clientCertificateKeyStoreUrl=file:cert/keystore.jks&clientCertificateKeyStorePassword=123456&trustCertificateKeyStoreUrl=file:cert/truststore.jks&trustCertificateKeyStorePassword=123456

문서화되어 있습니다.

여전히 찾고 있다면 다음과 같은 대답이 있습니다.

데이터 소스 URL 쿼리 매개 변수를 application.properties로 추가하는 방법은 무엇입니까?

spring.datasource.hikari.data-source-properties.useSSL=false

언급URL : https://stackoverflow.com/questions/35576994/spring-jpa-application-properties-usessl

반응형