why my spring app cant connect to DB?

hi guys. im using intellij idea to run my java spring app. i connected my db to the intellij idea.
host: localhost
port:5432
user:us3r
password:p4ss
URL:jdbc:postgresql://localhost:5432/postgres

im using ssh tunnel to connect to database. when i test the connection everything is fine. but the problem arises when i try to start my java spring app.

in
application.yaml
i have this piece of configuration:
spring:
  datasource:
    platform: postgres
    url: jdbc:postgresql://localhost:5432/lms_dev2
    username: us3r
    password: p4ss


and when i start the app i get
org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.


whats wrong? can smb help me out pls? thanks in advance
Was this page helpful?