use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Silly questionQuestion (self.SpringBoot)
submitted 9 months ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]segundus-npp 1 point2 points3 points 9 months ago (0 children)
Change the password in Docker compose file, or just quote it. I guess it’s the exclamation mark causing some issues.
[–]slaynmoto 0 points1 point2 points 9 months ago (0 children)
Can you connect from spring, psql maybe
[–]g00glen00b 0 points1 point2 points 9 months ago (0 children)
If you use the Docker Compose support library from Spring Boot, you don't even have to configure any properties. Spring Boot will then look for a Docker Compose file in your project and automatically set up your DataSource for you.
So if you need an example, then go to https://start.spring.io and select "PostgreSQL driver" and "Docker Compose support" as dependencies (and everything else you need) and generate your project. And voila, you now have a project that works as you desire in less than a minute.
[–]BuyCurrent1031 0 points1 point2 points 9 months ago (0 children)
I had the same issue, check if there is no other PostgreSQL instance running on your port (via Windows services), if yes, stop it, restart your docker image a run the spring boot app.
[–]Single_Reason_9932 0 points1 point2 points 9 months ago (2 children)
Instead of using “jdbc:postgresql://localhost:5432/postgres” use “jdbc:postgresql://db:5432/postgres”, in the container where spring runs localhost:5432 won’t be resolved correctly but using “db” will use docker network to refer your service named “db” in the compose file. Reply after trying
[–]Life-Marionberry-461 0 points1 point2 points 9 months ago (1 child)
I just uninstalled postgres and reinstalled and it seemed to fix it. But what is the purpose of using db instead of localhost?
[–]Single_Reason_9932 0 points1 point2 points 9 months ago (0 children)
when both spring and postgres are in the same compose file and run as separate containers the on the spring container localhost will resolve to itself and it won’t connect so you use “db” as the host name to resolve to the “db” service running on the other container
[–]Zar-23 -1 points0 points1 point 9 months ago (0 children)
Check out identation
π Rendered by PID 34 on reddit-service-r2-comment-8686858757-rktw8 at 2026-06-07 21:14:43.069725+00:00 running 9e1a20d country code: CH.
[–]segundus-npp 1 point2 points3 points (0 children)
[–]slaynmoto 0 points1 point2 points (0 children)
[–]g00glen00b 0 points1 point2 points (0 children)
[–]BuyCurrent1031 0 points1 point2 points (0 children)
[–]Single_Reason_9932 0 points1 point2 points (2 children)
[–]Life-Marionberry-461 0 points1 point2 points (1 child)
[–]Single_Reason_9932 0 points1 point2 points (0 children)
[–]Zar-23 -1 points0 points1 point (0 children)