Spring Tips: Spring Cloud Gateway for Spring MVC

Поделиться
HTML-код
  • Опубликовано: 23 апр 2024
  • Hi, Spring fans! In this installment, we revisit Spring Cloud Gateway, this time to look at the fantastic new support for Spring MVC, made all the more amazing by Java 21's virtual threads.
    #Java21 #java #SpringBoot #graalvm #springcloud #cloudcomputing #apigateway
  • НаукаНаука

Комментарии • 17

  • @SandipChitale
    @SandipChitale Месяц назад +10

    Thanks Josh. This will help a lot of people who did not switch over to Webflux, which admittedly (by Spring team members) a complex stack.
    It will be great if you could do a video with:
    - https support
    - stateless gateway using JWT (i.e. not using session) to support horizontal scaling on Kubernetes
    - how to deal with the downstream API that uses Hateos which returns linkrels, therefore how to deal with rewrites you did to strip /api/ prefix
    - streaming or request e.g. large file upload
    - streaming or response e.g. large file download

  • @rahulh7857
    @rahulh7857 10 дней назад

    Great presentation...

  • @arivan-amin
    @arivan-amin Месяц назад

    Thank you for these amazing content

  • @anjanx44
    @anjanx44 Месяц назад +1

    Thanks from Bangladesh

  • @thetrilbies1
    @thetrilbies1 Месяц назад

    Thanks for the video. Good to see how to get startwd with mvc gateway. Instead of requiring user to login via a login page, our apis is secured via access keys. Not sure if we can still use oauth2 in this situation? Like authenticate via access keys to obtain the outh token? Thanks

  • @epsig1507
    @epsig1507 Месяц назад +1

    Does a gateway still make sense if we have two instances of the backend very far apart? Let's say there are two instances of the same backend, one in the US and one in Asia (for minimal latency purposes). If the gateway is located in the US, a request coming from Asia has to go all the way to the US which then forwards it to Asia and back. Isn't just slowing things down?

    • @she.....
      @she..... Месяц назад +1

      You can deploy the gateway as multiple instances too and deploy them local to the region. Use the cdn or other strategies to identify the nearest instance

    • @epsig1507
      @epsig1507 Месяц назад

      @@she..... Yes that makes sense. I am currently using Geo DNS to send the request to the right region

  • @mohamadsharifi2353
    @mohamadsharifi2353 Месяц назад +1

    In case of token expiration does gateway handles refresh token?

    • @jurgen5557
      @jurgen5557 Месяц назад

      The TokenRelay of Gateway doesn't care about RefreshToken - i.e. if you enable this grant type on the Authorization Server and configure Gateway as Authorization Client (grant type authorization_code) on it with Token Relay between Auth- and Resource-Server (as Josh did here), the token refresh works "out of the box".

    • @aminesafi7261
      @aminesafi7261 Месяц назад

      The gateway act like a token relay so it propagates the token to the downstream services

    • @mohamadsharifi2353
      @mohamadsharifi2353 26 дней назад

      Actually I played with this gateway proxy and token relay, and it does not refresh the token. Maybe some additional configuration is required.

  • @EToniolo67
    @EToniolo67 Месяц назад

    Hi Josh, very interesting video, but I try to replicate it and only authentication works, subsequent redirection to gateway fails with no static resources found.
    I also tried your repository but I get the same result (small side note: your repository is a bit dirty due to the dependency on spring-ai and with the use of reserved port 1010).
    Thank you.

    • @MrPakurfulo
      @MrPakurfulo 22 дня назад

      Hello, are you accessing localhost or 127.0.0.1 in your browser? Try to access localhost instead of 127.0.0.1 and it will work. Or change the redirect uri to match the server you are trying to access from the browser. Otherwise it will fail because of the cookies. And yes port 1010 is reserved you are right about that, it needs to be changed