title: Spring Boot Microservice Architecture
body: <p>I'm new to Spring Boot and also microservices. Recently, I have tried to build a simple project but I have several doubts on how to implement user authentication and also application of resilience4j.
  Now, using the latest version of Spring Boot, I have the knowledge of</p>
  <ol>
  <li>Create Eureka Server and register several services</li>
  <li>Create a Spring Cloud API gateway to traverse to specific service</li>
  <li>Use RestTemplate to call from other microservices</li>
  <li>Testing the API in Postman</li>
  </ol>
  <p>Now I have a problem on how to implement user authentication. First, I think of adding authentication at the Spring Cloud API gateway which I will put the register and login method here. Previously, I have try with JWT authentication and when I want to add this authentication to Spring Cloud Gateway and apply some login and register functions, it seems to have some incompatibility issues where Spring Cloud Gateway cannot use together with Spring MVC as well as when I implement JWT authentication, it doesn't run well to display the token but display the generated password at the console which is not the desired result (maybe because I set the spring.mvc=reactive at properties file which I found the solution to solve the incompatible issue). Is JWT authentication cannot be implemented in Spring Cloud Gateway?</p>
  <p>Next I have seen several good example on applying JWT authentication using Zuul Gateway. However, it is not exist when I want to add the dependency from the Spring Initialzr. Is it deprecated and cant be use anymore? But is it logic to create another service solely for user authentication but there will not be any authentication take place at other services?</p>
  <ol>
  <li><p>So what is the best and easiest way for me to apply for user authentication, that is login before users can access to other services else they need to register first using the latest dependencies available in Spring Boot?</p>
  </li>
  <li><p>Next, I have learn some Resilience4j videos, but when I want to apply @Retry for user to input password for at most 3 times, which if password didn't match at the third time, notify the users that they should wait for 1 min and after that close the circuit again. But when I follow every step and go on testing, it didn't take any effect. I can still access the method for many times. Can someone show an example how to implement this?</p>
  </li>
  </ol>
  <p>Please tell me if there is any mistake on my logic and what I want to implement. And someone with experience and good knowledge can answer my questions and clear my doubts. Thanks in advance!</p>