Это видео недоступно.
Сожалеем об этом.
Build an ENTIRE Blog from Scratch in JUST 120 MINUTES - Java Spring Boot BEGINNER Tutorial!
HTML-код
- Опубликовано: 14 авг 2024
- Looking to create your own web application? Look no further! In this exciting tutorial, we'll take you step-by-step through the process of creating your very own Blog web application using Java Spring Boot for our server and Thymeleaf for the frontend.
Whether you're a seasoned developer or just getting started, this tutorial is perfect for anyone looking to learn more about web application development. You'll get a hands-on experience building your own app, as well as gaining valuable skills in Java Spring Boot and Thymeleaf.
👉👉Grab the source (on github): t.ly/6SrAa
🔗 Grab My Other Available Product(s):
- Build Your First Web Service API Using Java Spring Boot wazoowebbytes....
👋🏻Connect with me:
Twitter: / eyuzwa
===---=== Concepts ===---===
- Spring Data JPA
- Spring Security
- Thymeleaf
- Spring Web
- H2 Database
===---=== Chapters ===---===
00:00 - introduction
00:25 - simple blog demo
05:05 - create project at start.spring.io
06:46 - opening project in IntelliJ
08:30 - configuring h2 in application.properties
00:12:20 - first look at h2-console
00:13:16 - adding the Post model
00:15:58 - adding the PostRepository object
00:17:01 - adding a PostService object
00:20:31 - creating SeedData
00:24:17 - checking seed data in h2-console
00:24:54 - creating the HomeController
00:27:00 - creating the home template with Thymeleaf
00:33:20 - first run with home view
00:34:20 - creating the PostController
00:37:43 - creating the Post and 404 view templates
00:42:30 - adding an Account model
00:45:30 - setting up OneToMany in Account with Post
00:46:39 - setting up ManyToOne in Post with Account
00:48:02 - creating an AccountRepository
00:48:44 - creating an AccountService
00:49:46 - updating the SeedData
00:52:38 - checking relationships in h2-console
00:56:45 - adding a LoginController
00:57:17 - adding a RegisterController
00:57:40 - creating login and register templates
01:01:50 - adding register endpoint to controller
01:03:10 - creating login and register links
01:06:21 - checking registration in h2-console
01:07:01 - adding support for a new Post
01:07:28 - adding /posts/new GET in PostController
01:11:58 - adding post_new.html template
01:14:45 - adding /post/new POST in PostController
01:16:00 - first test of new post template
01:18:28 - adding Spring Boot Security
01:19:52 - updating the pom.xml
01:21:31 - adding a WebSecurityConfig
01:25:48 - first pass of whitelisted endpoints
01:26:57 - allowing /posts/* in whitelist
01:28:00 - allowing /h2-console/* in whitelist
01:30:42 - setting up login handling and validation
01:34:27 - setting up MyUserDetailsService object
01:39:37 - creating Authority model
01:40:43 - creating Account-Authority relationship
01:45:09 - updating SeedData with roles
01:46:26 - creating AuthorityRepository
01:47:42 - checking database for Authority
01:49:00 - debugging login and loadUserByUsername
01:51:24 - adding thymeleaf security to home.html
01:54:46 - adding PasswordEncoder to WebSecurityConfig
01:57:24 - successful login
01:58:10 - adding Post.updatedAt property
02:05:58 - adding delete to PostController
02:08:27 - adding modifiedAt to templates
#Java
#SpringBoot
#Tutorial
🔗Resources & Links mentioned in this video:
Spring Initializr: start.spring.io/
Visual Studio Code: code.visualstu...
Having been learning Spring Boot for a while, I was looking for a project I could work on just to practice what I've learned. This video has been very helpful.
thanks so much, glad I could try to help - and good luck on your practice!
Thank you for this. I'm going to use it as a basis for my portfolio project.
You're very welcome! Glad it was helpful and good luck with the portfolio!
coming last todo project, this very very helpful to understand a working project with all the functionality, many thanks to you wazoo, as a junior developer I found very hard to understand existing code bases in client projects, thats where this kind of videos help , please continue making these videos levelling up the functionality and extending the projects to be a full stack projects. thank you very much again.
thank you so much for the feedback, and best of success on your own developer journey!
@@wazoowebbytes thanks man you are an inspiration.
This is helping me so much in preparing for my upcoming hackathon. If all goes well, I will be landing my first dev job in a few weeks! Thank you for the tutorial!!
wow - thank you so much! Praying for your future and landing that first dev job!
.headers(HeadersConfigurer::disable), add this to security configuratios after http so xframe disabled and h2 loads
thanks! you might be needing this in a newer version of spring boot? I'll take a look - much appreciated!!
thank you! You really helped me. I didn't know how to solve this problem.
Amigos gracious amazing. Keep spreading valuable knowledge our spring boot guru🙂
gracias! Thanks a lot!
you are amazing, im waiting for next videos in curios.
thanks!
Small but important fact.
In newer version of Spring Security you have to add @Configuration annotation in addition to @EnableWebMvc
Thanks for spotting that and sharing! Yeah I'll have to make an updated version of this video for spring boot 3
My code is perfectly running but table is not showing as shown in 24:40 . what to do??
Thank you for releasing this!!
you're so welcome! Thanks for stopping by!
Thank you so much for this project. I have learnt many things from you. Keep going please
Thank you so much for the feedback!
Great tutorial :) Would be awesome to see more projects at the intermediate level using Spring Boot, preferably with React!
thanks for the feedback, I appreciate it. Yes, I'm working on more intermediate tutorials right now!
got error at 27.47 as Resource registered by this uri is not recognized (Settings | Languages & Frameworks | Schemas and DTDs) ,what to do next?
@@119_vaibhavthobbi2 interesting - I'll take a look!
@@119_vaibhavthobbi2 do you mean the reference to the thymeleaf namespace in the html node? (xmlns:th="www.thymeleaf.org")? That could just be a weird error from your IDE that you can ignore. Does it prevent the page from working?
@@wazoowebbytes sir I have fixed it , thanks for your reply...
Thank you for perfect lesson of spring boot!
thank you so much, I really appreciate it and am trying to be as clear as I can in each video!
Very helpful tutorial with great explanations, thank you!
thanks so much! Glad it helped you out - appreciate you leaving a comment
this is an amazing tutorial. thank you so much
thank you so much! I'm really happy to hear that it's helped you!
Please make more videos sir... Thank you so much very comprehensible.
Thank you, I will!
Hey !! After running server 12:34 it url and username on db console is still default even though i have changed the username to admin in application property file.What i need to check for this as i am facing similar issues from many days
interesting! Are you sure that you've deleted the existing database after changing the username and password in the application properties? Maybe it was created with the other username / password..? Hope that helps and thanks for stopping by!
Amazing!!! Congratulations!
Thank you so much! I really appreciate the kind words!
I see you updated image feature in github project. Can i ask where that video is (sorry for my bad english)
thanks! Your english is perfect here my friend! To tell you the truth, I haven't yet recorded that video. My humble apologies, I should sit down and do it. Thanks for mentioning it, I appreciate it!
it was perfect.
thank you so much!
Amazing to pracitce!!
nice!
Hi! This is so helpful video, I am learning Spring and what I didn`t understand, I understand in this video. Thank You! I have a question for you: I write code like you, but when I want to edit, I get 403 error. Why it could be happen?
In which part we define role of normal user and admin?
same issue here. Cant find the issue
@@oulvibakirli
From all youtube only you who have complete tutorial about spring boot with good understandeble english
thanks so much! I appreciate that!
can you also add some css to this ?
yeah - that's a good idea - thanks!
Hello, when I declare HomeController @RestController instead of @Controller, it returns a blank page with only "home" in it. Why is that?
great question! A big difference between them is that @Controller returns a view (aka. "home.html") whereas the @RestController cannot return a view (used for fetching data mostly)
@@wazoowebbytes Thank you! So when I need to return a .html file, i need to use @Controller. There isn't any way for @RestController right? Because I heard somewhere that @Controller is an old tech and we need to use @RestController everytime.
@@enesb4797 if you want to use an .html file, then correct, it's got to be @Controller. The @RestController is more for any data you're exposing through API. Maybe the "old tech" comment is about the actual approach to use a framework like React or Angular somewhere else and just talking to your Spring boot server...?
@@wazoowebbytes Thank you so much!
thanks, helped a lot!
Glad it helped! Hope you had some fun with it!
when I login it doesn't redirectr to home page whereas when debugging no error is showed
Hi Mr Wazoo, first of thank you very much for this wonderful project. my version finally compiled and works. I will like to ask if there a module to add media to posts, such as pictures, audio and videos. I am working on some styling features too.
awesome! So happy to hear you got it up and running! I haven't yet made one, but that's a great idea for a followup video. Also maybe upgrading this project to the newly released spring boot 3 - really appreciate the feedback!
I wish you explained spring security some more
thanks! yeah -- it's a huge topic, but important for sure
Hey Guru, can you teach us a complete ecommerce project with jwt role based authorization. Full of actual ecommerce sites functionality using spring boot and angular
I'll put that on my list - thanks for the suggestion!
@@wazoowebbytes Please make a descriptive project on requested topics. I've been searching for this. Thank you.
@@abhishekkumargupta9106 You bet - sorry RUclips tends to hide some of these comments on me!
I know it's been a while, but still, I have a small problem that I can't really figure out.
When I'm logged in with user1 I can edit other people's posts too, any idea?
sorry for the delay getting back to you! Yeah I see what's happening. In the PostController "updatePost" method there's no check to see if the principal (aka. current account) is the same one as the one on the Post field. Hope that helps you out!
How can i add comment section to posts
hey - should be fairly straight forward. I should make a followup video. But you'd likely start with a Comment model, then a @OneToMany relationship between Post and Comment (in other words, each Post can have many Comments).
Very helpful video. no one has explained spring boot integration with react so well. can you please create a video for Java+springboot+React+One To Many Bidirectional Mapping+Spring Security +swagger
thanks for the feedback and suggestion! I'll see what I can put together
getting error with edit button ....it always redirect me to page not found ....anyone can help !
THANK YOU! That bug must've been in there for a long time. My humble apologies. If you pull the latest code from the repo, you'll see the change that needed to be made there. Hope that helps you out!
why is the database on the repository mysql and not h2?
is there any reason you don't use the spring boot add-on for IntelliJ so as to just create spring applications from within Intelli j?
none at all - it works great! Maybe I'll use it in more videos, I was just trying to show that you can also generate a project outside of an IDE
@@wazoowebbytes No worries, great vids, thanks.
Any insight as to how you would integrate JMS into this? Or some sort of messaging service between registered users? Amazing tutorial btw - thanks!
thanks! Hmm it's worth some planning for that capability for sure. JMS has come in handy when working with async events such as needing to update something when a webhook is triggered, etc so that's where I would start...
@@wazoowebbytes Sorry to be a bother - which files would I begin this type of configuration in? I've been researching this for the last 2 weeks and have made no progress
@@kennedy-of8gn not a bother at all - I've been there many times my friend. I'll see what I can do for you...
@@kennedy-of8gn SORRY! RUclips really makes it difficult notifying me of comments! This is a basic starting point - spring.io/guides/gs/messaging-jms/ - but you may have found this already but maybe the demo git repo will help you with a starting point! good luck!
My code is perfectly running but table is not showing as shown in 24:40 . what to do??
I don't know that's pretty vague. Are you getting any kind of error? does your page work at all but just not seeing a table?
@@wazoowebbytes it is showing "There was an unexpected error (type=Not Found, status=404)" in white label error page and table is also not getting created
Please can you do a Tutorial About Spring Security including DB authentication?
I'll put it on my list! Thanks for stopping by and thanks for the suggestion!
Real back-end engineers don't need styling
preach it brother 🔥
I do the same in Eclipse IDE
but the property 'server.port=3000' is always ignored and set to default (8080)
project: .jar, embedded tomcar server
what can I do?
Thanks for the feedback. It sounds to me like Eclipse has a default setting in the debug configuration for your server to force that port to be 8080. I don't use Eclipse though, but do you see a configuration settings type of dialog?
@@wazoowebbytes kind of.
I just opened the config. settings, created one configuration, then removed it. result:
Tomcat started on port(s): 3000 (http) with context path ''
😁😜
@@goolkinsnose3936 haha nice one!
awesome
thanks!
does anyone else needed to install docker to run this project
hmm you're correct! I see what's happened. I made a few follow up videos to this project that make use of Docker. I'll see what I can do to the code repo - maybe create different branches depending on the video you're looking at?? I'll give it some thought. Thanks!!
@@wazoowebbytes i figured it out and made the changes and I really appreciate your efforts
awesome! Happy to hear that you got it up and running!
Is it ok that client recieves a domain entity in a responce, but not dto's from that entities?
yeah...I've personally never been sold on DTO's - they've always felt like extra objects I didn't need
and I'm working on some content now which actually makes some use of small DTO's to hopefully help explain things. Let's see how that goes...
@@wazoowebbytes I've subscribed)
@@nikita-shamrai thanks - much appreciated
Hello,
I have a problem with your code, in WebSecurityConfig, when inserting .antMatchers(WHITELIST).permitAll(), when I try to run the code I get an error:
java: cannot find symbol
symbol: method antMatchers(java.lang.String[])
location: class org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry
What should I do? Till then I did everything as you did.
Hi, thanks for the question - yeah in newer versions of Spring Security, the team has removed AntMatchers and want everyone to use RequestMatchers instead. I should get around to updating the github repository to reflect that, to help newer visitors out! Try using ".requestMatchers(WHITELIST).permitAll()" instead and see if that helps you move forward - meanwhile I'll look at the repo!
Yes, it works with RequestMatchers. It s not showing errors, but it wont let me past that security login page.@@wazoowebbytes