VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
Spring Boot Java Tutorial - REST API using PostgreSQL and JWT

Spring Boot Java Tutorial - REST API using PostgreSQL and JWT

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Learn to use Spring Boot and Java to create a complete REST API. We will use PostgreSQL as the relational database and Spring JdbcTemplate for interacting with that. Apart from this, we will add authentication using JWT (JSON Web Tokens). - Code: https://github.com/pairlearning/expense-tracker-api - Course from Pair Learning. Check out their YouTube channel: https://www.youtube.com/channel/UCLCn3zEnB0h0Y2GVhTLtHkg
Date: 2022-03-14

Comments and reviews: 10


Excellent content. Concepts are explained very well. The only problem with this video is it's not beginner complete. This video is much useful for people who have rest api background in java or are already familiar with how spring boot does dependency injection using spring bean creation using xml files. It also assumes that the viewer is familiar n-tier architecture. The tutorial doesn't explain the internal DB connection pools that spring boot provides by default. It would be great if there's a pre-requisite video to this explaining the concepts of spring, spring jdbc template and customizing the default HikariCP connection pool provided by spring boot. One more additional tutorial to this would be RestControllerAdvice and the concepts behind it in detail. Having said that this is an excellent tutorial that explains all the important concepts well.
reply

In case some of you have experienced an error when trying to register/login an user with the message: -java.lang.NoClassDefFoundError- let me tell you that all you have to do is add this dependency, that was not included in this tutorial due to the JDK version being used:
javax.xml.bind
jaxb-api
2.3.0
To put it simple, what this error is telling us is that a key dependency is missing so after a little research all you have to do is add that new dependency to your pom.xml and everything should be ok.
The explanation is the following: I was using JDK 11 and in Java 11 they have completely removed that dependency from the JDK so you'll need to include it in your project.

reply

I can't execute the register service.
I am getting an Unauthorized 401 error probably because that's what the exception is throwing. but I am not sure what I am missing
I am using Java8, I have added the dependency like someone suggested.
I also tried to test by cloning FreeCodeCamp's code from git and there I am getting a invalid CORS request- error

reply

Why are we implementing functions which are already implemented by spring ORM ?
I would prefer using ORM rather than writing query unless there is no way to get the data via ORM, is there any real advantage writing raw queries than using spring's ORM, like in terms of performance and reliability ?
Thanks a lot, really appreciate the content.

reply

For anyone else that gets an error for registering after implementing BCrypt, the problem is from the DB, at the password column from users where the maximum chars are 30, by BCrypt the password being encrypted it will have more than 30 chars so you will have to update the column password with more characters -password varchar(255) not null-
reply

Thanks for the tutorial.
I am facing one issue though:
I am using react and spring boot+ spring security.
Facing the cors issue while using the fetch API call.
Anyone aware of how to call fetch method for endpoints secured with spring security
Note: If I remove the spring security dependency, the fetch API call is successful.

reply

Thanks a lot for this! This is the only tutorial I found that explains JWT step by step in an understandable way. One shouls see this first before going to spring-boot security built in implementations.
reply

With spring data jpa all of the custom jdbc queries can be eliminated.
To make it easy , hey learners go and see what spring data rest offers you. You will be happy seeing spring boot -

reply

This tutorial is beyond greatness! Very clean, absolutely no distraction and straight to the point with high quality code! I will learn a lot from this in the near future!
reply

Thank you really much for lesson i support you guys but can you add subtitles no offence but im just beginner and it is hard to listen when you are foreigner
reply
Add a review, comment






Other channel videos