Build a CRUD Rest API in Java using Spring boot, Hibernate, Postgres, Docker and Docker Compose

  Рет қаралды 15,501

Francesco Ciulla

Francesco Ciulla

Күн бұрын

Пікірлер: 79
@francescociulla
@francescociulla Жыл бұрын
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
@lodimateus
@lodimateus Жыл бұрын
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
@francescociulla
@francescociulla Жыл бұрын
You are welcome!
@marcelomachado7168
@marcelomachado7168 11 ай бұрын
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.
@francescociulla
@francescociulla 11 ай бұрын
you are welcome! your comment has been featured here twitter.com/FrancescoCiull4/status/1747812657782984753
@TheAthanik
@TheAthanik Жыл бұрын
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.
@francescociulla
@francescociulla Жыл бұрын
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
@amanpatell
@amanpatell Ай бұрын
Smooth as butter. Thanks 💓
@francescociulla
@francescociulla Ай бұрын
you are welcome!
@amanpatell
@amanpatell Ай бұрын
@@francescociulla would you consider making spring boot tutorial? Loved your explanation.
@danielkacou5891
@danielkacou5891 4 ай бұрын
Thanks a lot for the great Docker tutorial. Greetings from Ivory Coast. 🔥
@francescociulla
@francescociulla 4 ай бұрын
thank you. your comment ahs been featured here: x.com/FrancescoCiull4/status/1819990331992985642
@nkantartzopoulos
@nkantartzopoulos 6 ай бұрын
If I could like this video 16 times I would do so.
@francescociulla
@francescociulla 6 ай бұрын
Thank you, appreciated!!
@jaybamroliya6443
@jaybamroliya6443 Жыл бұрын
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.
@francescociulla
@francescociulla Жыл бұрын
glad to know that, hope it was useful
@AnkitAgarwal-u1h
@AnkitAgarwal-u1h Жыл бұрын
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
@francescociulla
@francescociulla Жыл бұрын
glad it was useful!
@kirtanbornvita194
@kirtanbornvita194 6 ай бұрын
Finally started the video and it going very well really appreciate the work 🔥🔥🔥🔥
@francescociulla
@francescociulla 6 ай бұрын
you are welcome
@0x8strom
@0x8strom Жыл бұрын
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
@francescociulla Жыл бұрын
will take a look, thanks!
@0x8strom
@0x8strom Жыл бұрын
@@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?
@ossurf
@ossurf Жыл бұрын
Francesco TOP!!!!!!
@francescociulla
@francescociulla Жыл бұрын
eccolo il mitico!
@preciousmutungi9614
@preciousmutungi9614 6 ай бұрын
thank you. this helped alot!
@francescociulla
@francescociulla 6 ай бұрын
you are welcome!
@nicobost1950
@nicobost1950 Жыл бұрын
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
@nicobost1950
@nicobost1950 Жыл бұрын
nvm... i wrote "container name" and it should be "container_name"... always double check for typos
@francescociulla
@francescociulla Жыл бұрын
great you fixed it!
@jakub.686
@jakub.686 10 ай бұрын
good job, thank you!
@francescociulla
@francescociulla 10 ай бұрын
You are welcome!!
@sillycoda1084
@sillycoda1084 Жыл бұрын
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 :)
@francescociulla
@francescociulla Жыл бұрын
it's GitHub Copilot. RXJs fan here, I am friend wkrh Ben Lash!
@-maxxxeffect
@-maxxxeffect 9 ай бұрын
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
@francescociulla
@francescociulla 8 ай бұрын
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)
@-maxxxeffect
@-maxxxeffect 8 ай бұрын
@@francescociulla thank you!
@francescociulla
@francescociulla 8 ай бұрын
@@-maxxxeffect you are welcome, glad it helped!
@tobee1377
@tobee1377 4 ай бұрын
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?
@francescociulla
@francescociulla 4 ай бұрын
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
@KevinWebStudio
@KevinWebStudio 10 ай бұрын
thanks a lot
@francescociulla
@francescociulla 10 ай бұрын
you are welcome!
@supasweetato1538
@supasweetato1538 Жыл бұрын
Hi ! Really enjoyed your tutorial. Can you please tell me what is your plugin with expanded autocomplete code ?
@francescociulla
@francescociulla Жыл бұрын
it's called Github Copilot
@techadventures6645
@techadventures6645 Жыл бұрын
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
@francescociulla Жыл бұрын
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
@AN-tk5os
@AN-tk5os 11 ай бұрын
​@@francescociulla sir is it possible to do multi stage build and then run mvn and others at same time using dockerfile
@brettrucks7983
@brettrucks7983 Жыл бұрын
im getting this error " Error creating bean with name 'entityManagerFactory' defined in class path resource" when i run docker compose up
@brettrucks7983
@brettrucks7983 Жыл бұрын
its actually happening when i pull your down to so I must have something configured wrong on my vm
@francescociulla
@francescociulla Жыл бұрын
it might be related to the db configuration, did you lone the project and trie to run it?
@andrei3720
@andrei3720 Жыл бұрын
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
@francescociulla Жыл бұрын
do you already have something running on port 5432? which are the logs?
@andrei3720
@andrei3720 Жыл бұрын
@@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
@francescociulla Жыл бұрын
@@andrei3720 you don't have to install postgres. it runs in a container
@andrei3720
@andrei3720 Жыл бұрын
@@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
@mohammaddidehbanmehr7736
@mohammaddidehbanmehr7736 Жыл бұрын
@@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 "
@davetelekom443
@davetelekom443 7 ай бұрын
I am using the last Maven version, and do not build, I get errors.
@francescociulla
@francescociulla 7 ай бұрын
what error?
@davetelekom443
@davetelekom443 7 ай бұрын
@@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
@francescociulla
@francescociulla 7 ай бұрын
@@davetelekom443 ah you were using a differet db, yes of course you need to add the dependency. Well done!
@neb2777
@neb2777 Жыл бұрын
How do I connect a react frontend to this
@francescociulla
@francescociulla Жыл бұрын
I am working on a video about this, stay tuned. you cna check this kzbin.info/www/bejne/fZecg56XfdOmiJo
@kameronwelch7503
@kameronwelch7503 7 ай бұрын
@@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.
@bilalshaikh6603
@bilalshaikh6603 Жыл бұрын
Please share some resources to learn Java backend development.
@francescociulla
@francescociulla Жыл бұрын
haven't read anything ina while, so I don'tknow
@serychristianrenaud
@serychristianrenaud Жыл бұрын
thank
@francescociulla
@francescociulla Жыл бұрын
you are welcome
@pranavgor7278
@pranavgor7278 Ай бұрын
meanwhile me suing the eclipse and spring tool suite ☠
@francescociulla
@francescociulla 28 күн бұрын
lol why?
@pranavgor7278
@pranavgor7278 24 күн бұрын
@@francescociulla cause i am used
@yagizhan6342
@yagizhan6342 6 ай бұрын
When ı post my variables passing as null
@francescociulla
@francescociulla 5 ай бұрын
what do you mean?
@yagizhan6342
@yagizhan6342 5 ай бұрын
@@francescociulla thanks I solved the problem ❤️
@francescociulla
@francescociulla 5 ай бұрын
@@yagizhan6342 great, well done!
@shainkyjain3309
@shainkyjain3309 6 ай бұрын
FATAL: password authentication failed for user "postgres"
@francescociulla
@francescociulla 6 ай бұрын
the error seems clear, are you tunning another postgres instance, by chance? use your password
@shainkyjain3309
@shainkyjain3309 6 ай бұрын
@@francescociulla who knows whats happen? i tried mySql and it works
@francescociulla
@francescociulla 6 ай бұрын
@@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
번쩍번쩍 거리는 입
0:32
승비니 Seungbini
Рет қаралды 182 МЛН
Build a CRUD REST API with Rust Axum | Tutorial
19:41
cudidotdev
Рет қаралды 11 М.
Async Transform Streams - Part 1 - Sane C++ Libraries [ep.32]
1:07:20
Stefano Cristiano
Рет қаралды 75
Rust Lifetimes and How to Use Them
3:31
Learn Rust
Рет қаралды 166
03 ВЫЗОВ API при ЗАГРУЗКИ ЭКРАНА | Flutter: Rest API
7:12
ПАРЕНЬ ИЗ ОБЩАГИ
Рет қаралды 2
All the Rust Programming Language features
4:10
Francesco Ciulla
Рет қаралды 1,8 М.
ALWAYS LOVE YOUR MOM! ❤️ #shorts
0:55
LankyBox
Рет қаралды 23 МЛН
Kuruluş Osman 99. Bölüm @atv
2:15:39
Kuruluş Osman
Рет қаралды 6 МЛН
Месть от кутюр (2015) | Ты ведьма!
1:00
Vinogradenko
Рет қаралды 1,3 МЛН
Стреляй ей прямо между люлями #shorts
0:59
чебурашка это мышь
Рет қаралды 4,3 МЛН