Find Francesco: francescociulla.com 0:00:00 Intro, Requisites, architecture: Spring Boot, Hibernate, Postgres, Docker, Docker Compose 0:04:48 Java Spring Boot app initialization. A first test with an ERROR. 0:11:15 Postgres container in docker-compose.yml, TablePlus, applicationproperties, Error fixed. 0:22:00 Java App: USer.java, UserRepository.java, UserController.java. Test 0:43:10 Dockerfile, docker-compose.yml 0:57:00 Test with Postman
Thank you Francesco, you saved my life, I've been with this issue for a long days, and any tutorials helped me, because they don't explained about this issue. PS: If anyone have a problem when type "docker compose up" and occurs an issue about your DB password its wrong, just close de POSTGRES, only works if the POSTGRES its closed.
I got stuck in mvn building a doing tests with my localhost variables, I last about one day, trying to manage how get out of this situation, Francesco you came as an angel to me, THANK YOU!!!!!!!!!!! I think i was crazy because of this ahahahahhaa
Thanks @Francesco. Very well explained. I usually prepare Spring Boot Applications using Eclipse but amazed by the cool features of Visual Studio. Also great to see containerization of java application. Although, i didn't get complete hold of docker compose due to have beginner knowledge of docker
It would be recommended to use constructor injection when using spring. An easy way to do that would be to declare the UserRepository field as private final and then use it in the constructor of the controller as an argument like this: ... private final UserRepository repository; public UserController(UserRepository repository) { this.repository = repository; } ... And you don't need to use the @Autowired annotation. It is implied. Also, the preferred way to do dependency injection, is considered best practice. Really like your style of the video. Came here mainly for the docker stuff :D Thanks for taking the time to do this tutorial.
thanks for the update. the thing is that I didn't find a decent video explaining this stuff, and i was more focused on the docker part. I would def come back at this comment in case I'd do more stuff with Spring boot, that is actualy the first tech I used to create an API
Hey @Francesco Ciulla , You are doing amazing work , I am Java Developer and also working in spring boot so any need for community so I am always ready.
awesome video! for more spring magic you can check out the version 3.1.0-RC2 which automatically scans for a docker-compose file in the project directory and spins/stops up the containers. i really found it useful. hello francesco!
@@francescociulla i was hoping to get some pointers on applying for java/spring backend roles. what kind of portfolio projects do you think would be great to showcase?
i have a question... whenever i run the command at 15:20 there's an exception... "Additional property container name is not allowed"... beats me what i'm doing wrong
Thank you so much for your hard work! I am following through your guide now :) One question - what extension are you using in VSCode to have all the autocompletions being done for you? Especially in the properties file, see @ 18:00 timestamp.. Thank you and keep up the great work! Subb'ed :)
This is a good tutorial. Thanks!!! I am completely new to Docker and would like to know one thing. If I am using postgresql in one app, I am not able to use it another app. Error is showing port 5432 already in use. Isn't there any way where I can create one dedicated service for postgresql db and use it in multiple apps?
thank you. Yes, you can create a single PostgreSQL container and connect multiple apps to it. Just run the PostgreSQL container once, expose port 5432, and then configure your apps to connect to this shared database container instead of each running their own. let me know if that works
Hi, I liked the tutorial but I find it bit long to launch the server. Do I have to type everytime I wanna launch server : mvn clean install -DskipTests + docker compose build + docker compose up ? Are there no way to make it faster with maven ?
@@francescociulla I fixed. Some jdbc message when trying. I am using mysql so I added the dependency in the pom file and changed the dialect in the app.propierties file and now it works
Hey, great video! Sorry, just don't understand how does it work without UserService layer. In fact you didn't write findAll, fundByID methods. Why is there not compilation error? Why is the project launched succesfully. BTW I'm using gradle instead maven now
Thanks Max. it depends on the class you use in the Spring Data. the one I use automatically uses a service, that as intended to make the video easier. yes it should work well with Gradle, too (honestly I prefer that, but I wanted to make a video understandable by as many people as possible, that's why I used Maven)
I followed your tutorial step by step. Which is very good by the way. The problem is that I get an error: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. I got this error doing your tutorial and I also got it on an older project that I made in the past. The applications both work without docker. But whenever I do something with docker I get this error. I dont know what to do. Would reinstalling postgres maybe fix it? But I have many databases there and I dont want to lose them
@@francescociulla I shouldnt have. Only the postgres database is set on that port. I dont know the reason why I have this error. Maybe the only thing I can try is to reinstall postgres and clean everyhting. But I have this error happeneing not only on the project from this video but also on one of my older projects that I made in Spring
@@francescociulla Hey Frances, Thanks for the great video. Are you still planning on creating a video on how to connect a react frontend to this? It would be very much appreciated.
@@shainkyjain3309 it might be the version of postgres or another postgres instance up and running. You can check the environment variables in the postgres container to read the value of the password
Find Francesco: francescociulla.com
0:00:00 Intro, Requisites, architecture: Spring Boot, Hibernate, Postgres, Docker, Docker Compose
0:04:48 Java Spring Boot app initialization. A first test with an ERROR.
0:11:15 Postgres container in docker-compose.yml, TablePlus, applicationproperties, Error fixed.
0:22:00 Java App: USer.java, UserRepository.java, UserController.java. Test
0:43:10 Dockerfile, docker-compose.yml
0:57:00 Test with Postman
Thank you Francesco, you saved my life, I've been with this issue for a long days, and any tutorials helped me, because they don't explained about this issue.
PS: If anyone have a problem when type "docker compose up" and occurs an issue about your DB password its wrong, just close de POSTGRES, only works if the POSTGRES its closed.
you are welcome! your comment has been featured here twitter.com/FrancescoCiull4/status/1747812657782984753
I got stuck in mvn building a doing tests with my localhost variables, I last about one day, trying to manage how get out of this situation, Francesco you came as an angel to me, THANK YOU!!!!!!!!!!! I think i was crazy because of this ahahahahhaa
You are welcome!
Thanks a lot for the great Docker tutorial. Greetings from Ivory Coast. 🔥
thank you. your comment ahs been featured here: x.com/FrancescoCiull4/status/1819990331992985642
Finally started the video and it going very well really appreciate the work 🔥🔥🔥🔥
you are welcome
Smooth as butter. Thanks 💓
you are welcome!
@@francescociulla would you consider making spring boot tutorial? Loved your explanation.
Thanks @Francesco. Very well explained. I usually prepare Spring Boot Applications using Eclipse but amazed by the cool features of Visual Studio. Also great to see containerization of java application. Although, i didn't get complete hold of docker compose due to have beginner knowledge of docker
glad it was useful!
It would be recommended to use constructor injection when using spring. An easy way to do that would be to declare the UserRepository field as private final and then use it in the constructor of the controller as an argument like this:
...
private final UserRepository repository;
public UserController(UserRepository repository) {
this.repository = repository;
}
...
And you don't need to use the @Autowired annotation. It is implied. Also, the preferred way to do dependency injection, is considered best practice.
Really like your style of the video. Came here mainly for the docker stuff :D
Thanks for taking the time to do this tutorial.
thanks for the update. the thing is that I didn't find a decent video explaining this stuff, and i was more focused on the docker part. I would def come back at this comment in case I'd do more stuff with Spring boot, that is actualy the first tech I used to create an API
If I could like this video 16 times I would do so.
Thank you, appreciated!!
Hey @Francesco Ciulla , You are doing amazing work , I am Java Developer and also working in spring boot so any need for community so I am always ready.
glad to know that, hope it was useful
awesome video!
for more spring magic you can check out the version 3.1.0-RC2 which automatically scans for a docker-compose file in the project directory and spins/stops up the containers. i really found it useful.
hello francesco!
will take a look, thanks!
@@francescociulla i was hoping to get some pointers on applying for java/spring backend roles. what kind of portfolio projects do you think would be great to showcase?
i have a question... whenever i run the command at 15:20 there's an exception... "Additional property container name is not allowed"... beats me what i'm doing wrong
nvm... i wrote "container name" and it should be "container_name"... always double check for typos
great you fixed it!
thank you. this helped alot!
you are welcome!
Francesco TOP!!!!!!
eccolo il mitico!
good job, thank you!
You are welcome!!
Thank you so much for your hard work! I am following through your guide now :) One question - what extension are you using in VSCode to have all the autocompletions being done for you? Especially in the properties file, see @ 18:00 timestamp.. Thank you and keep up the great work! Subb'ed :)
it's GitHub Copilot. RXJs fan here, I am friend wkrh Ben Lash!
thanks a lot
you are welcome!
im getting this error " Error creating bean with name 'entityManagerFactory' defined in class path resource" when i run docker compose up
its actually happening when i pull your down to so I must have something configured wrong on my vm
it might be related to the db configuration, did you lone the project and trie to run it?
This is a good tutorial. Thanks!!! I am completely new to Docker and would like to know one thing. If I am using postgresql in one app, I am not able to use it another app. Error is showing port 5432 already in use. Isn't there any way where I can create one dedicated service for postgresql db and use it in multiple apps?
thank you. Yes, you can create a single PostgreSQL container and connect multiple apps to it. Just run the PostgreSQL container once, expose port 5432, and then configure your apps to connect to this shared database container instead of each running their own. let me know if that works
Hi, I liked the tutorial but I find it bit long to launch the server.
Do I have to type everytime I wanna launch server : mvn clean install -DskipTests + docker compose build + docker compose up ?
Are there no way to make it faster with maven ?
I agree it's a slow process but it has its pros and cons. you can try to use a mvn image from docker hub and build inside the mvn
@@francescociulla sir is it possible to do multi stage build and then run mvn and others at same time using dockerfile
Hi ! Really enjoyed your tutorial. Can you please tell me what is your plugin with expanded autocomplete code ?
it's called Github Copilot
I am using the last Maven version, and do not build, I get errors.
what error?
@@francescociulla I fixed. Some jdbc message when trying. I am using mysql so I added the dependency in the pom file and changed the dialect in the app.propierties file and now it works
@@davetelekom443 ah you were using a differet db, yes of course you need to add the dependency. Well done!
Hey, great video!
Sorry, just don't understand how does it work without UserService layer. In fact you didn't write findAll, fundByID methods. Why is there not compilation error? Why is the project launched succesfully.
BTW I'm using gradle instead maven now
Thanks Max. it depends on the class you use in the Spring Data. the one I use automatically uses a service, that as intended to make the video easier. yes it should work well with Gradle, too (honestly I prefer that, but I wanted to make a video understandable by as many people as possible, that's why I used Maven)
@@francescociulla thank you!
@@-maxxxeffect you are welcome, glad it helped!
I followed your tutorial step by step. Which is very good by the way. The problem is that I get an error: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP
connections. I got this error doing your tutorial and I also got it on an older project that I made in the past. The applications both work without docker. But whenever I do something with docker I get this error. I dont know what to do. Would reinstalling postgres maybe fix it? But I have many databases there and I dont want to lose them
do you already have something running on port 5432? which are the logs?
@@francescociulla I shouldnt have. Only the postgres database is set on that port. I dont know the reason why I have this error. Maybe the only thing I can try is to reinstall postgres and clean everyhting. But I have this error happeneing not only on the project from this video but also on one of my older projects that I made in Spring
@@andrei3720 you don't have to install postgres. it runs in a container
@@francescociulla Then I have no idea what to do. The app runs good on the browser in localhost, but I cant make it compile and run with Docker
@@andrei3720 might wroth a shot to try this if you haven't already:
"sudo lsof -i:5432" then get the process id and do "sudo kill -9 "
How do I connect a react frontend to this
I am working on a video about this, stay tuned. you cna check this th-cam.com/video/Gf9RkaHnsR8/w-d-xo.html
@@francescociulla Hey Frances, Thanks for the great video. Are you still planning on creating a video on how to connect a react frontend to this? It would be very much appreciated.
thank
you are welcome
When ı post my variables passing as null
what do you mean?
@@francescociulla thanks I solved the problem ❤️
@@yagizhan6342 great, well done!
Please share some resources to learn Java backend development.
haven't read anything ina while, so I don'tknow
FATAL: password authentication failed for user "postgres"
the error seems clear, are you tunning another postgres instance, by chance? use your password
@@francescociulla who knows whats happen? i tried mySql and it works
@@shainkyjain3309 it might be the version of postgres or another postgres instance up and running. You can check the environment variables in the postgres container to read the value of the password
meanwhile me suing the eclipse and spring tool suite ☠
lol why?
@@francescociulla cause i am used