Error querying database. Cause: java.lang.IllegalArgumentException:Failed to decrypt.(错误笔记)
java.lang.IllegalArgumentException:Failed to decrypt
从错误可以看出,解密失败。
原因是你在数据库连接配置的地方,设置了加密。即:
config.decrypt=true
将其改成:
config.decrypt=false
问题就可以解决。
public-key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAITOx1pKAT9xh7cfoZqUw6SLjgl/Y44M2XUAw37aRndmku+FSdGp9PXGwJYoeXt/TbxR1DSdd7S2+/s1cUsvvDMCAwEAAQ== spring: http: encoding: charset: UTF-8 force: true enabled: true datasource: druid: url: jdbc:mysql://localhost:3306/fairchild?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # url: jdbc:mysql://192.168.31.196:3306/fairchild?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai username: root password: 123456 driver-class-name: com.mysql.cj.jdbc.Driver # connection-properties: config.decrypt=true;config.decrypt.key=${public-key} initial-size: 5 min-idle: 10 max-active: 20 max-wait: 60000 time-between-eviction-runs-millis: 2000 min-evictable-idle-time-millis: 60000 max-evictable-idle-time-millis: 9000000 test-while-idle: true test-on-borrow: false test-on-return: false validation-query: select 1 pool-prepared-statements: true max-open-prepared-statements: 20 async-init: true stat-view-servlet: enabled: true url-pattern: /druid/* reset-enable: true login-username: druid login-password: druid web-stat-filter: enabled: true url-pattern: /* exclusions: "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*" session-stat-enable: false profile-enable: true filter: wall: enabled: true db-type: mysql config: enabled: true aop-patterns: cn.com.coding4fun.* jpa: show-sql: true generate-ddl: false hibernate: ddl-auto: none open-in-view: true properties: hibernate: format_sql: true order_updates: true order_inserts: true jdbc: batch_size: 50 fetch_size: 50 javax: cache: provider: org.ehcache.jsr107.EhcacheCachingProvider uri: classpath:hibernate-ehcache.xml missing_cache_strategy: create enable_lazy_load_no_trans: true cache: use_query_cache: true use_second_level_cache: true region_prefix: jcache-hibernate use_minimal_puts: false use_reference_entries: true use_structured_entries: false auto_evict_collection_cache: false hibernate.cache.default_cache_concurrency_strategy: read-only region: factory_class: jcache cache: jcache: provider: org.ehcache.jsr107.EhcacheCachingProvider config: classpath:ehcache.xml messages: basename: i18n/messages encoding: UTF-8 server: port: 8081 tomcat: uri-encoding: UTF-8