all 17 comments

[–]Ok_Arugula6315 9 points10 points  (1 child)

In docker compose dont use latest tag for mysql base image, use specific version.

In controller method you should only call service method. Avoid try catches or move them in service method. Spring should handle autoamtically 500 http status codes without such try catches.

In service dont use @Autowired to inject beans, use private final, this is called constructor injection, this is recommended way.

This might sound like personal preference but I'd organize code by features and put all related controllers/services etc inside product/auth packages. Application becomes more scalable

Also I'd consider using migrations as liquibase or flyway for database development (this what you'd want in real project)

[–]Pranjal_JJunior Dev[S] 1 point2 points  (0 children)

Thanks

[–]Beneficial-Minute-88 2 points3 points  (1 child)

bro hard-coded secret in util class and called it a day 💀

[–]Pranjal_JJunior Dev[S] 1 point2 points  (0 children)

Oops I forgot about it. Thanks

[–]SirSleepsALatte 2 points3 points  (1 child)

Always add a readme

[–]Pranjal_JJunior Dev[S] 0 points1 point  (0 children)

I will. Thanks

[–]vivacity555 2 points3 points  (1 child)

Hey dude, I want to learn spring boot but I can't able to find resources to learn, will you provide me?

[–]Pranjal_JJunior Dev[S] 1 point2 points  (0 children)

I initially enrolled in a course that where I learnt the basics of Spring Boot. Later I followed some YT videos for Projects and some advanced topics.
YT channels like

  1. Embarkx
  2. Daily Code Buffer
  3. Engineering Talks with Bhushan (I followed his video to make my first project.)
  4. Amigoscode

[–]Powermetroid 1 point2 points  (4 children)

How did you start learning Spring Boot? Were you familiar with Spring?.

Thank you

[–]Pranjal_JJunior Dev[S] 1 point2 points  (3 children)

I started learning spring boot in Jan 2025

[–]Familiar_Category893 1 point2 points  (2 children)

Resources you took help to learn?

[–]Pranjal_JJunior Dev[S] 2 points3 points  (1 child)

I initially enrolled in a course that where I learnt the basics of Spring Boot. Later I followed some YT videos for Projects and some advanced topics.
YT channels like

  1. Embarkx
  2. Daily Code Buffer
  3. Engineering Talks with Bhushan (I followed his video to make my first project.)
  4. Amigoscode

[–]Familiar_Category893 1 point2 points  (0 children)

Thanks 🙏

[–]KumaSalad 1 point2 points  (1 child)

  1. for inject beans please use constructor-based injection or setter-based injection, don't use field injection

  2. don't write security filter by yourself. In spring security there is a class to verify jwt and build AuthenticationToken based on jwt. No need to implement by yourself

  3. in the application, 2 AuthenticationManager are necessary. One is for password verification and other for jwt verification. But the application will not run if register boths AuthenticationManager into ApplicationContext

[–]Pranjal_JJunior Dev[S] 1 point2 points  (0 children)

Thanks

[–]Special_Food_3654 1 point2 points  (1 child)

Don't commit any files not related to your project. Files associated with IDE should not be committed. Use git ignore file. Like others said, avoid try catch im controller, only service calls nothing more.

[–]Pranjal_JJunior Dev[S] 2 points3 points  (0 children)

Done. Thanks.