Hi Dan, Thanks for one more good video as always 😊. Can you please come with the changes to spring security in spring boot 3.1.1 ? When I upgraded my spring boot version from 3.0.8 to 3.1.1, the security filter chain bean giving me warning. http.csrf() is going to be deprecated and asking to use http.csrf(withDefaults()). http.headers(), http.sessionManagement() are also marked for depreciation and asking to go for withDefaults. What caused them to be marked for depreciation?
Does Spring have any tools to automate (as much as possible) the process of making a multi-container deployment? For example, if you wanted to build your project into a jar and also run that in a Docker container? That specifically has been giving me issues for about a week now, in particular it seems it can’t talk to the database that’s running as part of my same compose file…?
I could not start pgAdmin image. pgAdmin desktop already installed in my computer so I thought port 5050 is already occupied. And lastly I changed the port ports 8888:80, than I can connect. Thank you for the video :)
High quality, useful video once again Dan! Question: Do you ever utilize the database tool in Intellij? Not as feature rich or pretty as pgAdmin, but super convenient when trying to stay in intellij.
It is great that it works for you. i mean, you are able to verify that the table and record was indeed created in the db running in container. What will happen when you have posgres db installed on your local machine. in my case, i can see the ddl sql that the table got created but it gets created in the local postgres (not in the postgres inside the container) My compose file looks like: (container starts fine using docker compose up -d) services: postgres: image: postgres:16 container_name: postgres_con ports: - "5432:5432" environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: admin POSTGRES_DB: postgres Rest is defined in application.properties file. Why is the table not getting created in the db inside the container? spring.application.name=product-service #spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.hibernate.show-sql=true spring.jpa.show-sql=true spring.datasource.url=jdbc:postgresql://localhost:5432/postgres #spring.datasource.url=jdbc:postgresql://postgres_con:5432/postgres spring.datasource.username=postgres spring.datasource.password=admin
UPDATE: I tried my entire exercise on laptop without Postgres installed and this time, the table was created in the postgres db running inside docker container. I verified by connecting to the postgres instance via docker exec -it postgres_con psql -U postgres -d postgres \dt and select query. May be when Postgres is locally installed then the local installation is used by default. I wonder if there is a way to skip using the local instance and use the postgres in the docker container?
Hi Dan, Thanks for the high-quality content that are you sharing with the community. Is Docker Compose Support suitable for leveraging multiple DBs: for example having entities repository for Domain APIs in a DB (Postgres), and spring batch feature's schema in a different DB (MySQL for instance)? When placing multiple DBs in my compose.yml file, SpringBoot spawns multiple ConnectionDetails beans but what's the right way to manage them? Parameter 1 of method dataSource in org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari required a single bean, but 2 were found: - jdbcConnectionDetailsForDemoDb1: defined in unknown location - jdbcConnectionDetailsForDemoDbBatch1: defined in unknown location A video with multiple DBs created by the Docker Compose integration would be awesome.
I downloaded the github project and tried running it. I get the following error: org.springframework.boot.docker.compose.core.DockerOutputParseException: Failed to parse docker JSON: I have docker installed and can manually run docker-compose on the compose.yaml file and the containers start. However, the app fails with the above error.
OK, I figured out my problem. I had an older version of docker installed on my Linux system that did work with the Spring Boot Docker Compose plugin. I removed the old version of docker and replaced it with the latest Docker-Desktop version and now the project runs without errors.
Great. There is no need to use the IP of the container, just use the service. Think in the scripts run in the pgadmin is using already the service name instead the ip
Thank you so much! This video cleared up so many things for me! You're a great teacher!
Your videos have been really helpful in understanding spring boot.
I appreciate that and I am glad I can help out.
top quality tutorials!
Hi Dan, Thanks for one more good video as always 😊. Can you please come with the changes to spring security in spring boot 3.1.1 ? When I upgraded my spring boot version from 3.0.8 to 3.1.1, the security filter chain bean giving me warning. http.csrf() is going to be deprecated and asking to use http.csrf(withDefaults()).
http.headers(), http.sessionManagement() are also marked for depreciation and asking to go for withDefaults.
What caused them to be marked for depreciation?
Awesome video
Wish spring would do the same for podman. The ability to chose your container engine would be great.
Nice tutorial. I cant remember the last time I used PGAdmin though. I use the built-in DB tool inside IntelliJ IDEA Ultimate Edition.
Same here. Super convenient
Great tutorial ❤
Does Spring have any tools to automate (as much as possible) the process of making a multi-container deployment? For example, if you wanted to build your project into a jar and also run that in a Docker container? That specifically has been giving me issues for about a week now, in particular it seems it can’t talk to the database that’s running as part of my same compose file…?
Thanks!
I could not start pgAdmin image. pgAdmin desktop already installed in my computer so I thought port 5050 is already occupied. And lastly I changed the port ports 8888:80, than I can connect. Thank you for the video :)
Do you need both generate-ddl and ddl-auto properties or is the latter one enough?
Thanks Dan very useful tutorial but please can you make a video on the last repo that you used to auto connect on pgadmin.
That’s this one ☝🏻 At the end I talk about that setup
High quality, useful video once again Dan! Question: Do you ever utilize the database tool in Intellij? Not as feature rich or pretty as pgAdmin, but super convenient when trying to stay in intellij.
It is great that it works for you. i mean, you are able to verify that the table and record was indeed created in the db running in container.
What will happen when you have posgres db installed on your local machine.
in my case, i can see the ddl sql that the table got created but it gets created in the local postgres (not in the postgres inside the container)
My compose file looks like: (container starts fine using docker compose up -d)
services:
postgres:
image: postgres:16
container_name: postgres_con
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: admin
POSTGRES_DB: postgres
Rest is defined in application.properties file.
Why is the table not getting created in the db inside the container?
spring.application.name=product-service
#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.hibernate.show-sql=true
spring.jpa.show-sql=true
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
#spring.datasource.url=jdbc:postgresql://postgres_con:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=admin
UPDATE:
I tried my entire exercise on laptop without Postgres installed and this time, the table was created in the postgres db running inside docker container.
I verified by connecting to the postgres instance via
docker exec -it postgres_con psql -U postgres -d postgres
\dt
and select query.
May be when Postgres is locally installed then the local installation is used by default.
I wonder if there is a way to skip using the local instance and use the postgres in the docker container?
Hi Dan, Thanks for the high-quality content that are you sharing with the community.
Is Docker Compose Support suitable for leveraging multiple DBs: for example having entities repository for Domain APIs in a DB (Postgres), and spring batch feature's schema in a different DB (MySQL for instance)?
When placing multiple DBs in my compose.yml file, SpringBoot spawns multiple ConnectionDetails beans but what's the right way to manage them?
Parameter 1 of method dataSource in org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari required a single bean, but 2 were found:
- jdbcConnectionDetailsForDemoDb1: defined in unknown location
- jdbcConnectionDetailsForDemoDbBatch1: defined in unknown location
A video with multiple DBs created by the Docker Compose integration would be awesome.
I downloaded the github project and tried running it. I get the following error:
org.springframework.boot.docker.compose.core.DockerOutputParseException: Failed to parse docker JSON:
I have docker installed and can manually run docker-compose on the compose.yaml file and the containers start. However, the app fails with the above error.
OK, I figured out my problem. I had an older version of docker installed on my Linux system that did work with the Spring Boot Docker Compose plugin. I removed the old version of docker and replaced it with the latest Docker-Desktop version and now the project runs without errors.
50th...Thanks Dan
Great. There is no need to use the IP of the container, just use the service. Think in the scripts run in the pgadmin is using already the service name instead the ip
yeah, this worked