从部署在 Heroku 中的 springboot 连接到我服务器中的 Postgres

connect to Postgres in my server from springboot deployed in Heroku

我在 heroku 中有一个 spring 启动应用程序,它带有 heroku 自动提供的 postgre 数据库。

我想要来自我自己服务器的数据库。我已经在 application.properties 中设置了数据库。但是 heroku 手动设置数据库。

我已经尝试使用 cli heroku set database_url、分离并再次附加数据库,

heroku addons:create heroku-postgresql:hobby-dev

还是连接不上

如何连接到我自己的 Postgres

2020-02-01T12:38:31.601041+00:00 app[web.1]: 
2020-02-01T12:38:32.109014+00:00 app[web.1]: 2020-02-01 12:38:32.108 ERROR 4 --- [           main] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.
2020-02-01T12:38:32.109039+00:00 app[web.1]: 
2020-02-01T12:38:32.109042+00:00 app[web.1]: org.postgresql.util.PSQLException: The server does not support SSL.
2020-02-01T12:38:32.109044+00:00 app[web.1]:    at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:431) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.109047+00:00 app[web.1]:    at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:135) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.109049+00:00 app[web.1]:    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.109051+00:00 app[web.1]:    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.109054+00:00 app[web.1]:    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:211) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.109056+00:00 app[web.1]:    at org.postgresql.Driver.makeConnection(Driver.java:458) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.109058+00:00 app[web.1]:    at org.postgresql.Driver.connect(Driver.java:260) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.109060+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109062+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109065+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:744) [tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109067+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:676) [tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109069+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) [tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109071+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) [tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109072+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) [tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109074+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) [tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109076+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.DataSourceProxy.getIdle(DataSourceProxy.java:667) [tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109098+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.DataSourceProxy.getNumIdle(DataSourceProxy.java:678) [tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.109101+00:00 app[web.1]:    at org.springframework.boot.jdbc.metadata.TomcatDataSourcePoolMetadata.getIdle(TomcatDataSourcePoolMetadata.java:42) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109103+00:00 app[web.1]:    at org.springframework.boot.actuate.metrics.jdbc.DataSourcePoolMetrics$CachingDataSourcePoolMetadataProvider.lambda$getValueFunction[=11=](DataSourcePoolMetrics.java:99) ~[spring-boot-actuator-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109105+00:00 app[web.1]:    at org.springframework.boot.actuate.metrics.jdbc.DataSourcePoolMetrics.bindDataSource(DataSourcePoolMetrics.java:82) ~[spring-boot-actuator-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109109+00:00 app[web.1]:    at org.springframework.boot.actuate.metrics.jdbc.DataSourcePoolMetrics.bindPoolMetadata(DataSourcePoolMetrics.java:77) ~[spring-boot-actuator-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109111+00:00 app[web.1]:    at org.springframework.boot.actuate.metrics.jdbc.DataSourcePoolMetrics.bindTo(DataSourcePoolMetrics.java:69) ~[spring-boot-actuator-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109114+00:00 app[web.1]:    at org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration.bindDataSourceToRegistry(DataSourcePoolMetricsAutoConfiguration.java:82) ~[spring-boot-actuator-autoconfigure-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109116+00:00 app[web.1]:    at org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration.lambda$bindDataSourcesToRegistry[=11=](DataSourcePoolMetricsAutoConfiguration.java:75) ~[spring-boot-actuator-autoconfigure-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109118+00:00 app[web.1]:    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.109120+00:00 app[web.1]:    at org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration.bindDataSourcesToRegistry(DataSourcePoolMetricsAutoConfiguration.java:74) ~[spring-boot-actuator-autoconfigure-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109139+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.109142+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.109144+00:00 app[web.1]:    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.109146+00:00 app[web.1]:    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.109149+00:00 app[web.1]:    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:755) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109151+00:00 app[web.1]:    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109153+00:00 app[web.1]:    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109155+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109157+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109159+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109161+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=11=](AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109164+00:00 app[web.1]:    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109166+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109168+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109170+00:00 app[web.1]:    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109171+00:00 app[web.1]:    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109174+00:00 app[web.1]:    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.109176+00:00 app[web.1]:    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109178+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109180+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109182+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109184+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109186+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.109188+00:00 app[web.1]:    at com.notification.NotificationApplication.main(NotificationApplication.java:14) ~[classes!/:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.109190+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.109192+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.109195+00:00 app[web.1]:    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.109196+00:00 app[web.1]:    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.109205+00:00 app[web.1]:    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[notification-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.109207+00:00 app[web.1]:    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[notification-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.109209+00:00 app[web.1]:    at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[notification-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.109212+00:00 app[web.1]:    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[notification-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.109214+00:00 app[web.1]: 
2020-02-01T12:38:32.116402+00:00 app[web.1]: 2020-02-01 12:38:32.116  WARN 4 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.RuntimeException: org.postgresql.util.PSQLException: The server does not support SSL.
2020-02-01T12:38:32.116630+00:00 app[web.1]: 2020-02-01 12:38:32.116  INFO 4 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2020-02-01T12:38:32.133717+00:00 app[web.1]: 2020-02-01 12:38:32.133  INFO 4 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-02-01T12:38:32.142586+00:00 app[web.1]: 2020-02-01 12:38:32.142  INFO 4 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2020-02-01T12:38:32.187477+00:00 app[web.1]: 2020-02-01 12:38:32.187  INFO 4 --- [           main] ConditionEvaluationReportLoggingListener : 
2020-02-01T12:38:32.187481+00:00 app[web.1]: 
2020-02-01T12:38:32.187483+00:00 app[web.1]: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-02-01T12:38:32.193686+00:00 app[web.1]: 2020-02-01 12:38:32.193 ERROR 4 --- [           main] o.s.boot.SpringApplication               : Application run failed
2020-02-01T12:38:32.193689+00:00 app[web.1]: 
2020-02-01T12:38:32.193695+00:00 app[web.1]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.RuntimeException: org.postgresql.util.PSQLException: The server does not support SSL.
2020-02-01T12:38:32.193697+00:00 app[web.1]:    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193700+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193702+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193704+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193707+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=11=](AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193709+00:00 app[web.1]:    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193712+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193714+00:00 app[web.1]:    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193717+00:00 app[web.1]:    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193727+00:00 app[web.1]:    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193730+00:00 app[web.1]:    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193732+00:00 app[web.1]:    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193735+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193737+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193739+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193741+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193743+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193745+00:00 app[web.1]:    at com.notification.NotificationApplication.main(NotificationApplication.java:14) [classes!/:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.193748+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.193750+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.193752+00:00 app[web.1]:    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.193754+00:00 app[web.1]:    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.193756+00:00 app[web.1]:    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [notification-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.193758+00:00 app[web.1]:    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [notification-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.193766+00:00 app[web.1]:    at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [notification-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.193768+00:00 app[web.1]:    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [notification-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2020-02-01T12:38:32.193770+00:00 app[web.1]: Caused by: java.lang.RuntimeException: org.postgresql.util.PSQLException: The server does not support SSL.
2020-02-01T12:38:32.193772+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.DataSourceProxy.getIdle(DataSourceProxy.java:669) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193775+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.DataSourceProxy.getNumIdle(DataSourceProxy.java:678) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193777+00:00 app[web.1]:    at org.springframework.boot.jdbc.metadata.TomcatDataSourcePoolMetadata.getIdle(TomcatDataSourcePoolMetadata.java:42) ~[spring-boot-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193780+00:00 app[web.1]:    at org.springframework.boot.actuate.metrics.jdbc.DataSourcePoolMetrics$CachingDataSourcePoolMetadataProvider.lambda$getValueFunction[=11=](DataSourcePoolMetrics.java:99) ~[spring-boot-actuator-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193782+00:00 app[web.1]:    at org.springframework.boot.actuate.metrics.jdbc.DataSourcePoolMetrics.bindDataSource(DataSourcePoolMetrics.java:82) ~[spring-boot-actuator-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193784+00:00 app[web.1]:    at org.springframework.boot.actuate.metrics.jdbc.DataSourcePoolMetrics.bindPoolMetadata(DataSourcePoolMetrics.java:77) ~[spring-boot-actuator-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193786+00:00 app[web.1]:    at org.springframework.boot.actuate.metrics.jdbc.DataSourcePoolMetrics.bindTo(DataSourcePoolMetrics.java:69) ~[spring-boot-actuator-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193789+00:00 app[web.1]:    at org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration.bindDataSourceToRegistry(DataSourcePoolMetricsAutoConfiguration.java:82) ~[spring-boot-actuator-autoconfigure-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193791+00:00 app[web.1]:    at org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration.lambda$bindDataSourcesToRegistry[=11=](DataSourcePoolMetricsAutoConfiguration.java:75) ~[spring-boot-actuator-autoconfigure-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193793+00:00 app[web.1]:    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.193795+00:00 app[web.1]:    at org.springframework.boot.actuate.autoconfigure.metrics.jdbc.DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration.bindDataSourcesToRegistry(DataSourcePoolMetricsAutoConfiguration.java:74) ~[spring-boot-actuator-autoconfigure-2.2.4.RELEASE.jar!/:2.2.4.RELEASE]
2020-02-01T12:38:32.193797+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.193799+00:00 app[web.1]:    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.193801+00:00 app[web.1]:    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.193803+00:00 app[web.1]:    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232-heroku]
2020-02-01T12:38:32.193806+00:00 app[web.1]:    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:755) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193808+00:00 app[web.1]:    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193810+00:00 app[web.1]:    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.3.RELEASE.jar!/:5.2.3.RELEASE]
2020-02-01T12:38:32.193812+00:00 app[web.1]:    ... 25 common frames omitted
2020-02-01T12:38:32.193814+00:00 app[web.1]: Caused by: org.postgresql.util.PSQLException: The server does not support SSL.
2020-02-01T12:38:32.193816+00:00 app[web.1]:    at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:431) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.193818+00:00 app[web.1]:    at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:135) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.193820+00:00 app[web.1]:    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.193822+00:00 app[web.1]:    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.193829+00:00 app[web.1]:    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:211) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.193831+00:00 app[web.1]:    at org.postgresql.Driver.makeConnection(Driver.java:458) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.193833+00:00 app[web.1]:    at org.postgresql.Driver.connect(Driver.java:260) ~[postgresql-42.2.9.jar!/:42.2.9]
2020-02-01T12:38:32.193835+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193837+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193839+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:744) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193841+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:676) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193843+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193845+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193847+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193849+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193851+00:00 app[web.1]:    at org.apache.tomcat.jdbc.pool.DataSourceProxy.getIdle(DataSourceProxy.java:667) ~[tomcat-jdbc-9.0.30.jar!/:na]
2020-02-01T12:38:32.193854+00:00 app[web.1]:    ... 42 common frames omitted
2020-02-01T12:38:32.193856+00:00 app[web.1]: 
2020-02-01T12:38:32.301651+00:00 heroku[web.1]: State changed from starting to crashed
2020-02-01T12:38:32.279876+00:00 heroku[web.1]: Process exited with status 1

没关系。我自己找到的。

add/set

 SKIP_PGCONFIG_INSTALL = true ,

 DATABASE_URL= postgresql://<username>:<password>@<host>:<port>/<dbname> , 

 SPRING_DATASOURCE_URL jdbc:postgresql://<host>:<port>/<dbname> , 

 SPRING_DATASOURCE_USERNAME= <usernamedb>,

 and `SPRING_DATASOURCE_PASSWORD`=<passworddb>

在配置变量 heroku 设置中。