我想關閉ssl,到我的本地mysql數據庫。 但我無法在spring.properties文件中找到實際屬性。spring jpa application.properties useSSL
我的當前文件是:
# ===============================
# = 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
,因爲它是默認情況下禁用你不需要做任何事情來關閉SSL([你必須添加'useSSL = true'到你的JDBC url並配置幾個屬性來啓用它](https://dev.mysql.com/doc/connector-j/en/connector-j-reference-using-ssl。 HTML))。 –
@AndyWilkinson感謝您的回覆。我知道使用'useSSL = true',以後我會使用它。但是,我的問題是如何在spring application.properties文件中添加'useSSL = true/false'。你不能將它添加到我嘗試過的datasource.url中,參見上文。 – SJC