2016-02-23 13 views
11

私はローカルのmysqlデータベースにsslをオフにしようとしています。 しかし、これを行う春のapplication.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を試してみましたし、それが動作しません。また、私は以下に私の問題を修正

+1

であるあなた

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

であるあなたは、それはデフォルトでは無効だとしてSSLをオフにするには何もする必要はありません([ JDBC URLに 'useSSL = true'を追加し、それを有効にするためにいくつかのプロパティを設定する必要があります](https://dev.mysql.com/doc/connector-j/en/connector-j-reference-using-ssl)。 html))。 –

+1

@AndyWilkinson返事をありがとう。後で私が使用する 'useSSL = true'の使用について知っています。しかし、私の質問は、春のapplication.propertiesファイルに 'useSSL = true/false'を追加する方法でした。あなたは私が試したdatasource.urlに上記を追加することはできません。 – SJC

答えて

20

spring.datasource.url = jdbc:mysql://localhost:3306/test&useSSL=falseを試してみました:「?」あなたが使用してはいけません

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

代わりに「&」

のこれは私が言っていることは

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