Coder Social home page Coder Social logo

packtpublishing / microservices-with-spring-boot-and-spring-cloud-2e Goto Github PK

View Code? Open in Web Editor NEW
235.0 18.0 258.0 1.26 MB

Microservices-with-Spring-Boot-and-Spring-Cloud-2E, Published by Packt

License: MIT License

Shell 11.63% Java 86.14% Dockerfile 2.00% Smarty 0.23%

microservices-with-spring-boot-and-spring-cloud-2e's Introduction

Microservices with Spring Boot and Spring Cloud, Second Edition

Microservices with Spring Boot and Spring Cloud, Second Edition

This is the code repository for Microservices with Spring Boot and Spring Cloud, Second Edition, published by Packt.

Build resilient and scalable microservices using Spring Cloud, Istio, and Kubernetes

About the book

With this book, you'll learn how to efficiently build and deploy microservices. This new edition has been updated for the most recent versions of Spring, Java, Kubernetes, and Istio, demonstrating faster and simpler handling of Spring Boot, local Kubernetes clusters, and Istio installation. The expanded scope includes native compilation of Spring-based microservices, support for Mac and Windows with WSL2, and an introduction to Helm 3 for packaging and deployment. A revamped security chapter now follows the OAuth 2.1 specification and makes use of the newly launched Spring Authorization Server from the Spring team.

Starting with a set of simple cooperating microservices, you'll add persistence and resilience, make your microservices reactive, and document their APIs using OpenAPI.

You’ll understand how fundamental design patterns are applied to add important functionality, such as service discovery with Netflix Eureka and edge servers with Spring Cloud Gateway. You’ll learn how to deploy your microservices using Kubernetes and adopt Istio. You'll explore centralized log management using the Elasticsearch, Fluentd, and Kibana (EFK) stack and monitor microservices using Prometheus and Grafana.

By the end of this book, you'll be confident in building microservices that are scalable and robust using Spring Boot and Spring Cloud.

What you will learn

  1. Build reactive microservices using Spring Boot
  2. Develop resilient and scalable microservices using Spring Cloud
  3. Use OAuth 2.1/OIDC and Spring Security to protect public APIs
  4. Implement Docker to bridge the gap between development, testing, and production
  5. Deploy and manage microservices with Kubernetes
  6. Apply Istio for improved security, observability, and traffic management
  7. Write and run automated microservice tests with JUnit, testcontainers, Gradle, and bash

Try out new versions

If you want to try out the source code of this book with newer versions of Spring, Java, Kubernetes, and Istio than used in the book, you can take a look at the following blog posts:

  1. Upgrade to Spring Boot 2.7 and Spring Native 0.12 (published 19 September 2022)

  2. Upgrade to Kubernetes 1.25 and Istio 1.15 (published 4 October 2022)

  3. Develop, build and deploy microservices on Apple silicon (ARM64) (published 2 November 2022)

Errata

  • Page 147 (Defining index for MongoDB): The description does not mention that auto-creation of an index is disabled since Spring Data MongoDB 3.0. Therefore, index creation is handled programmatically by the main classes ProductServiceApplication and RecommendationServiceApplication. For example, see the method initIndicesAfterStartup in the ProductServiceApplication class.

    For more information, see:

  • Page 153 (Testcontainers for MongoDB): The sentence For the product and review microservices, which use MongoDB, a corresponding base class, MongoDbTestBase, has been added should be For the product and recommendation microservices, which use MongoDB, a corresponding base class, MongoDbTestBase, has been added.

Download a free PDF

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.

https://packt.link/free-ebook/9781801072977

microservices-with-spring-boot-and-spring-cloud-2e's People

Contributors

anikets-cpu avatar magnus-larsson avatar packt-itservice avatar packtriannar avatar packtutkarshr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microservices-with-spring-boot-and-spring-cloud-2e's Issues

Chapter 06 - DuplicateKeyException Test for MongoDB

Not an issue, more to highlight for others if they run into the problem.

I couldn't get the duplicate() test for the product-service to pass for a while, until I looked at the source code for ProductServiceApplication in the code repo for Chapter06. Apparently, the @indexed annotation isn't sufficient to actual create the unique index on productId, you need to use the IndexOperations ensureIndex functionality that's part of the Spring Data MongoDB library. So be sure to examine and copy the code from Chapter 06 here

Again, not an issue with the code, but it was something that wasn't called out specifically in the book, and this might be new to folks who are new to Spring Data MongoDB and index creation.

So far, enjoying the book, thanks!

Gradle error (Project with path ':api' could not be found in root project 'util'.)

I am trying to build the util project on the page 68.
I keep getting the build error:

Build file '/Users/junhyungki/Desktop/microservices/util/build.gradle' line: 21

A problem occurred evaluating root project 'util'.
> Project with path ':api' could not be found in root project 'util'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

if I add
include ':api' in settings.gradle, it will throw a different error:

Could not determine the dependencies of task ':compileJava'.
> Could not resolve all task dependencies for configuration ':compileClasspath'.
   > Could not resolve project :api.
     Required by:
         project :
      > No matching configuration of project :api was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - None of the consumable configurations have attributes.

I am stuck here.
How can I proceed?

Chapter 19. Centralized Logging with the EFK Stack | Error on step Initializing Kibana

Hello, guys!
Need an assistance!

When i click on "Create index Pattern", i have an error

Screenshot from 2022-07-20 06-41-35

Error message:

{"statusCode":429,"error":"Too Many Requests","message":"index [.kibana_7.12.1_001] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block];: cluster_block_exception"}

I think the reason what there is not enough free space.
But, how to increase space for this service?

Thanks.

=========================

I also replaced images:

#image: docker.elastic.co/elasticsearch/elasticsearch:7.12.1
image: elasticsearch:7.12.1

#image: docker.elastic.co/kibana/kibana:7.12.1
image: kibana:7.12.1

=========================


Environment

$ cat /etc/os-release | grep 'VERSION='
VERSION="20.04.4 LTS (Focal Fossa)"

$ java -version
java version "17.0.2" 2022-01-18 LTS

$ docker -v
Docker version 20.10.15, build fd82621

I updated gradle to work with JDK17

==================================


Minikube runs with command:

$ minikube start \
    --profile=handson-spring-boot-cloud \
    --memory=10240 \
    --cpus=4 \
    --disk-size=30g \
    --kubernetes-version=v1.20.5 \
    --driver=docker \
    --ports=8080:80 --ports=8443:443 \
    --ports=30080:30080 --ports=30443:30443

Chap03 - Product-Composite-Service Tests Not Passing

Hello,
In the unit tests for the product-composite-service in Chapter 3, all 3 tests fail with a 'No content - 404 Not Found'.
I've even copied the test code verbatim from the source ProductCompositeServiceApplicationTests.java with the same result.

For example on getProductInvalidInput():

GET http://localhost:43167/product-composite/3
accept-encoding: [gzip]
user-agent: [ReactorNetty/1.1.3]
host: [localhost:43167]
WebTestClient-Request-Id: [2]
Accept: [application/json]

No content

404 NOT_FOUND Not Found
Vary: [Origin, Access-Control-Request-Method, Access-Control-Request-Headers]
Content-Type: [application/json]
Transfer-Encoding: [chunked]
Date: [Tue, 28 Feb 2023 23:20:41 GMT]

{"timestamp":"2023-02-28T23:20:41.406+00:00","status":404,"error":"Not Found","path":"/product-composite/3"}

Status expected:<422 UNPROCESSABLE_ENTITY> but was:<404 NOT_FOUND>
Expected :422 UNPROCESSABLE_ENTITY
Actual :404 NOT_FOUND

I'm at a loss as to what I'm doing wrong here.
Any help is much appreciated.
Thank you!

Exec mysql is not working

I am going through chapter-06, But when I was trying to see table mysql with detail:

  • MYSQL_ROOT_PASSWORD=rootpwd
  • MYSQL_DATABASE=review-db
  • MYSQL_USER=user
    • MYSQL_PASSWORD=pwd

Its now showing any table:

image

Chapter 16: problem with test-em-all.bash and Kubernetes

Hi, while running the code in chapter 16, I'm experiencing problems with the test-em-all.bash script when it is running in a Kubernetes cluster.

I was trying to reproduce what you did in the section "Deploying to Kubernetes for development and test". My version can be found on GitHub at the following URL: Chapter16_init. Since I have a Mac M1, I had to adapt your version of the project (See the "arm64" bullet in the README.md file). A detailed description of the steps that I did can be found in the section Deploying to Kubernetes for development and test of the same README.md file.

First, I started a cluster inspired by what you did in chapter 15, but without ingress and the metric-server (see Develop, build and deploy microservices on Apple silicon (ARM64) | Callista).

Then, for gradle to build successfully, I had to skip the unit tests since some tests were failing (see the "gradle build" bullet). Note that if I run gradle build outside of the minikube environment, they all pass.

After that, I was able to follow the rest of your instructions without any problem up to the test_em_all.sh script. When I start the script, it waits for ever for a response from the actuator health.

Start Tests: Ven 27 jan 2023 07:22:53 EST
HOST=192.168.67.2
PORT=30443
USE_K8S=true
SKIP_CB_TESTS=false
Wait for: curl -k https://192.168.67.2:30443/actuator/health... , retry #1 , retry #2 , retry #3 , retry #4 , retry #5 , retry #6 , retry #7 , retry #8

Note that I have the same problem if I use a plain minikube cluster (i.e. via minikube start).

I hope that in my GitHub repository, you'll find everything you need to diagnose the problem.

Finally, I'd like to thank you for your book. So far, it is the most complete reference on the subject and I would recommend it to everyone.

Thanks in advance

Calling a block() method in performanse and scalability persepctive

Good afternoon!
In 7 chapter said:
Calling a block() method is, in general, considered a bad practice from a performance and scalability perspective. But in this case, we will only handle a few incoming messages in parallel, one per partition.
What do you recommend use to avoid performance and scalability in production project struggles?

Swagger Auth-Server Config.

After I click on the "Authorize" button, I end up on the login page. But after I enter the credentials, I get redirected to this error page
https://localhost:8443/oauth2/authorize?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjarshttps%3A%2Flocalhost%3A8443%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=chat%3Aread%20chat%3Awrite&state=U2F0IE1heSAyMSAyMDIyIDEyOjI4OjI2IEdNVCswMjAwIChDZW50cmFsIEV1cm9wZWFuIFN1bW1lciBUaW1lKQ%3D%3D

022-05-21 10:28:16.701 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/chat-composite/**]" does not match against value "/openapi/swagger-ui.html"
2022-05-21T10:28:16.701915000Z 2022-05-21 10:28:16.701 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/oauth2/**]" does not match against value "/openapi/swagger-ui.html"
2022-05-21T10:28:16.710477600Z 2022-05-21 10:28:16.710 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/login/**]" does not match against value "/openapi/swagger-ui.html"
2022-05-21T10:28:16.714731900Z 2022-05-21 10:28:16.711 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/error/**]" does not match against value "/openapi/swagger-ui.html"
2022-05-21T10:28:16.721042000Z 2022-05-21 10:28:16.715 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "/openapi/**" matches against value "/openapi/swagger-ui.html"
2022-05-21T10:28:16.721085600Z 2022-05-21 10:28:16.716 DEBUG 1 --- [     parallel-1] o.s.c.g.h.RoutePredicateHandlerMapping   : Route matched: chat-composite-swagger-ui
2022-05-21T10:28:16.721094700Z 2022-05-21 10:28:16.717 DEBUG 1 --- [     parallel-1] o.s.c.g.h.RoutePredicateHandlerMapping   : Mapping [Exchange: GET https://localhost:8443/openapi/swagger-ui.html] to Route{id='chat-composite-swagger-ui', uri=lb://chat-composite, order=0, predicate=Paths: [/openapi/**], match trailing slash: true, gatewayFilters=[], metadata={}}
2022-05-21T10:28:16.721101300Z 2022-05-21 10:28:16.717 DEBUG 1 --- [     parallel-1] o.s.c.g.h.RoutePredicateHandlerMapping   : [939ee057-1] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@183ff136
2022-05-21T10:28:16.721108100Z 2022-05-21 10:28:16.718 DEBUG 1 --- [     parallel-1] o.s.c.g.handler.FilteringWebHandler      : Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@2673487b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@6e948f1c}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@3de56885}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@194224ca}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@350f18a6}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@2d07aacc}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@2fb48970}, order = 10150], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@254e9709}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@4e8d9bb6}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@ff5d4f1}, order = 2147483647]]
2022-05-21T10:28:16.729719200Z 2022-05-21 10:28:16.729 TRACE 1 --- [     parallel-1] o.s.c.g.filter.RouteToRequestUrlFilter   : RouteToRequestUrlFilter start
2022-05-21T10:28:16.731375600Z 2022-05-21 10:28:16.731 TRACE 1 --- [     parallel-1] s.c.g.f.ReactiveLoadBalancerClientFilter : ReactiveLoadBalancerClientFilter url before: lb://chat-composite/openapi/swagger-ui.html
2022-05-21T10:28:16.971369400Z 2022-05-21 10:28:16.971 TRACE 1 --- [     parallel-1] s.c.g.f.ReactiveLoadBalancerClientFilter : LoadBalancerClientFilter url chosen: http://64885baa833a:8080/openapi/swagger-ui.html
2022-05-21T10:28:17.325812600Z 2022-05-21 10:28:17.325 TRACE 1 --- [or-http-epoll-2] o.s.c.gateway.filter.NettyRoutingFilter  : outbound route: a70962ea, inbound: [939ee057-1] 
2022-05-21T10:28:17.426821100Z 2022-05-21 10:28:17.425 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.NettyWriteResponseFilter  : NettyWriteResponseFilter start inbound: a70962ea, outbound: [939ee057-1] 
2022-05-21T10:28:17.477673700Z 2022-05-21 10:28:17.473 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.GatewayMetricsFilter      : spring.cloud.gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=302),tag(outcome=REDIRECTION),tag(routeId=chat-composite-swagger-ui),tag(routeUri=lb://chat-composite),tag(status=FOUND)]
2022-05-21T10:28:17.493618900Z 2022-05-21 10:28:17.493 TRACE 1 --- [or-http-epoll-4] o.s.w.s.adapter.HttpWebHandlerAdapter    : [939ee057-1] Completed 302 FOUND, headers={masked}
2022-05-21T10:28:17.507203200Z 2022-05-21 10:28:17.498 TRACE 1 --- [or-http-epoll-4] o.s.w.s.adapter.HttpWebHandlerAdapter    : [939ee057-2] HTTP GET "/openapi/webjars/swagger-ui/index.html?configUrl=/openapi/v3/api-docs/swagger-config", headers={masked}
2022-05-21T10:28:17.537971600Z 2022-05-21 10:28:17.537 TRACE 1 --- [     parallel-3] o.s.c.g.f.WeightCalculatorWebFilter      : Weights attr: {}
2022-05-21T10:28:17.541323600Z 2022-05-21 10:28:17.540 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/chat-composite/**]" does not match against value "/openapi/webjars/swagger-ui/index.html"
2022-05-21T10:28:17.541510200Z 2022-05-21 10:28:17.541 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/oauth2/**]" does not match against value "/openapi/webjars/swagger-ui/index.html"
2022-05-21T10:28:17.541775000Z 2022-05-21 10:28:17.541 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/login/**]" does not match against value "/openapi/webjars/swagger-ui/index.html"
2022-05-21T10:28:17.543101600Z 2022-05-21 10:28:17.541 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/error/**]" does not match against value "/openapi/webjars/swagger-ui/index.html"
2022-05-21T10:28:17.555071100Z 2022-05-21 10:28:17.544 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "/openapi/**" matches against value "/openapi/webjars/swagger-ui/index.html"
2022-05-21T10:28:17.555126700Z 2022-05-21 10:28:17.544 DEBUG 1 --- [     parallel-3] o.s.c.g.h.RoutePredicateHandlerMapping   : Route matched: chat-composite-swagger-ui
2022-05-21T10:28:17.555150800Z 2022-05-21 10:28:17.545 DEBUG 1 --- [     parallel-3] o.s.c.g.h.RoutePredicateHandlerMapping   : Mapping [Exchange: GET https://localhost:8443/openapi/webjars/swagger-ui/index.html?configUrl=/openapi/v3/api-docs/swagger-config] to Route{id='chat-composite-swagger-ui', uri=lb://chat-composite, order=0, predicate=Paths: [/openapi/**], match trailing slash: true, gatewayFilters=[], metadata={}}
2022-05-21T10:28:17.555158200Z 2022-05-21 10:28:17.545 DEBUG 1 --- [     parallel-3] o.s.c.g.h.RoutePredicateHandlerMapping   : [939ee057-2] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@183ff136
2022-05-21T10:28:17.555165400Z 2022-05-21 10:28:17.547 DEBUG 1 --- [     parallel-3] o.s.c.g.handler.FilteringWebHandler      : Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@2673487b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@6e948f1c}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@3de56885}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@194224ca}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@350f18a6}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@2d07aacc}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@2fb48970}, order = 10150], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@254e9709}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@4e8d9bb6}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@ff5d4f1}, order = 2147483647]]
2022-05-21T10:28:17.555175000Z 2022-05-21 10:28:17.547 TRACE 1 --- [     parallel-3] o.s.c.g.filter.RouteToRequestUrlFilter   : RouteToRequestUrlFilter start
2022-05-21T10:28:17.555180700Z 2022-05-21 10:28:17.548 TRACE 1 --- [     parallel-3] s.c.g.f.ReactiveLoadBalancerClientFilter : ReactiveLoadBalancerClientFilter url before: lb://chat-composite/openapi/webjars/swagger-ui/index.html?configUrl=/openapi/v3/api-docs/swagger-config
2022-05-21T10:28:17.556884300Z 2022-05-21 10:28:17.556 TRACE 1 --- [     parallel-3] s.c.g.f.ReactiveLoadBalancerClientFilter : LoadBalancerClientFilter url chosen: http://64885baa833a:8080/openapi/webjars/swagger-ui/index.html?configUrl=/openapi/v3/api-docs/swagger-config
2022-05-21T10:28:17.559963500Z 2022-05-21 10:28:17.559 TRACE 1 --- [or-http-epoll-2] o.s.c.gateway.filter.NettyRoutingFilter  : outbound route: a70962ea, inbound: [939ee057-2] 
2022-05-21T10:28:17.579046000Z 2022-05-21 10:28:17.577 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.NettyWriteResponseFilter  : NettyWriteResponseFilter start inbound: a70962ea, outbound: [939ee057-2] 
2022-05-21T10:28:17.596260500Z 2022-05-21 10:28:17.595 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.GatewayMetricsFilter      : spring.cloud.gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=200),tag(outcome=SUCCESSFUL),tag(routeId=chat-composite-swagger-ui),tag(routeUri=lb://chat-composite),tag(status=OK)]
2022-05-21T10:28:17.610945500Z 2022-05-21 10:28:17.601 TRACE 1 --- [or-http-epoll-4] o.s.w.s.adapter.HttpWebHandlerAdapter    : [939ee057-2] Completed 200 OK, headers={masked}
2022-05-21T10:28:17.697004300Z 2022-05-21 10:28:17.696 TRACE 1 --- [or-http-epoll-4] o.s.w.s.adapter.HttpWebHandlerAdapter    : [939ee057-3] HTTP GET "/openapi/webjars/swagger-ui/swagger-ui.css", headers={masked}
2022-05-21T10:28:17.761926100Z 2022-05-21 10:28:17.739 TRACE 1 --- [     parallel-4] o.s.c.g.f.WeightCalculatorWebFilter      : Weights attr: {}
2022-05-21T10:28:17.761989300Z 2022-05-21 10:28:17.756 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/chat-composite/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui.css"
2022-05-21T10:28:17.762001100Z 2022-05-21 10:28:17.758 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/oauth2/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui.css"
2022-05-21T10:28:17.762008000Z 2022-05-21 10:28:17.759 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/login/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui.css"
2022-05-21T10:28:17.806090700Z 2022-05-21 10:28:17.803 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/error/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui.css"
2022-05-21T10:28:17.806139700Z 2022-05-21 10:28:17.804 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "/openapi/**" matches against value "/openapi/webjars/swagger-ui/swagger-ui.css"
2022-05-21T10:28:17.806152900Z 2022-05-21 10:28:17.805 DEBUG 1 --- [     parallel-4] o.s.c.g.h.RoutePredicateHandlerMapping   : Route matched: chat-composite-swagger-ui
2022-05-21T10:28:17.806303600Z 2022-05-21 10:28:17.805 DEBUG 1 --- [     parallel-4] o.s.c.g.h.RoutePredicateHandlerMapping   : Mapping [Exchange: GET https://localhost:8443/openapi/webjars/swagger-ui/swagger-ui.css] to Route{id='chat-composite-swagger-ui', uri=lb://chat-composite, order=0, predicate=Paths: [/openapi/**], match trailing slash: true, gatewayFilters=[], metadata={}}
2022-05-21T10:28:17.806316000Z 2022-05-21 10:28:17.805 DEBUG 1 --- [     parallel-4] o.s.c.g.h.RoutePredicateHandlerMapping   : [939ee057-3] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@183ff136
2022-05-21T10:28:17.806325300Z 2022-05-21 10:28:17.805 DEBUG 1 --- [     parallel-4] o.s.c.g.handler.FilteringWebHandler      : Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@2673487b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@6e948f1c}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@3de56885}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@194224ca}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@350f18a6}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@2d07aacc}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@2fb48970}, order = 10150], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@254e9709}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@4e8d9bb6}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@ff5d4f1}, order = 2147483647]]
2022-05-21T10:28:17.807729200Z 2022-05-21 10:28:17.806 TRACE 1 --- [     parallel-4] o.s.c.g.filter.RouteToRequestUrlFilter   : RouteToRequestUrlFilter start
2022-05-21T10:28:17.892218000Z 2022-05-21 10:28:17.850 TRACE 1 --- [     parallel-4] s.c.g.f.ReactiveLoadBalancerClientFilter : ReactiveLoadBalancerClientFilter url before: lb://chat-composite/openapi/webjars/swagger-ui/swagger-ui.css
2022-05-21T10:28:17.892274500Z 2022-05-21 10:28:17.851 TRACE 1 --- [     parallel-4] s.c.g.f.ReactiveLoadBalancerClientFilter : LoadBalancerClientFilter url chosen: http://64885baa833a:8080/openapi/webjars/swagger-ui/swagger-ui.css
2022-05-21T10:28:17.892286300Z 2022-05-21 10:28:17.854 TRACE 1 --- [or-http-epoll-2] o.s.c.gateway.filter.NettyRoutingFilter  : outbound route: a70962ea, inbound: [939ee057-3] 
2022-05-21T10:28:18.424297700Z 2022-05-21 10:28:18.416 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.NettyWriteResponseFilter  : NettyWriteResponseFilter start inbound: a70962ea, outbound: [939ee057-3] 
2022-05-21T10:28:18.483977400Z 2022-05-21 10:28:18.475 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.GatewayMetricsFilter      : spring.cloud.gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=200),tag(outcome=SUCCESSFUL),tag(routeId=chat-composite-swagger-ui),tag(routeUri=lb://chat-composite),tag(status=OK)]
2022-05-21T10:28:18.731743800Z 2022-05-21 10:28:18.731 TRACE 1 --- [or-http-epoll-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-1] HTTP GET "/openapi/webjars/swagger-ui/swagger-ui-bundle.js", headers={masked}
2022-05-21T10:28:18.749989700Z 2022-05-21 10:28:18.749 TRACE 1 --- [     parallel-1] o.s.c.g.f.WeightCalculatorWebFilter      : Weights attr: {}
2022-05-21T10:28:18.779631900Z 2022-05-21 10:28:18.766 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/chat-composite/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui-bundle.js"
2022-05-21T10:28:18.789322600Z 2022-05-21 10:28:18.788 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/oauth2/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui-bundle.js"
2022-05-21T10:28:18.790292100Z 2022-05-21 10:28:18.789 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/login/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui-bundle.js"
2022-05-21T10:28:18.802610300Z 2022-05-21 10:28:18.790 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/error/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui-bundle.js"
2022-05-21T10:28:18.830900800Z 2022-05-21 10:28:18.829 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "/openapi/**" matches against value "/openapi/webjars/swagger-ui/swagger-ui-bundle.js"
2022-05-21T10:28:18.830964700Z 2022-05-21 10:28:18.830 DEBUG 1 --- [     parallel-1] o.s.c.g.h.RoutePredicateHandlerMapping   : Route matched: chat-composite-swagger-ui
2022-05-21T10:28:18.830976200Z 2022-05-21 10:28:18.830 DEBUG 1 --- [     parallel-1] o.s.c.g.h.RoutePredicateHandlerMapping   : Mapping [Exchange: GET https://localhost:8443/openapi/webjars/swagger-ui/swagger-ui-bundle.js] to Route{id='chat-composite-swagger-ui', uri=lb://chat-composite, order=0, predicate=Paths: [/openapi/**], match trailing slash: true, gatewayFilters=[], metadata={}}
2022-05-21T10:28:18.830983000Z 2022-05-21 10:28:18.830 DEBUG 1 --- [     parallel-1] o.s.c.g.h.RoutePredicateHandlerMapping   : [c4b942d2-1] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@183ff136
2022-05-21T10:28:18.844242900Z 2022-05-21 10:28:18.841 DEBUG 1 --- [     parallel-1] o.s.c.g.handler.FilteringWebHandler      : Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@2673487b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@6e948f1c}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@3de56885}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@194224ca}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@350f18a6}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@2d07aacc}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@2fb48970}, order = 10150], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@254e9709}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@4e8d9bb6}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@ff5d4f1}, order = 2147483647]]
2022-05-21T10:28:18.844285700Z 2022-05-21 10:28:18.843 TRACE 1 --- [     parallel-1] o.s.c.g.filter.RouteToRequestUrlFilter   : RouteToRequestUrlFilter start
2022-05-21T10:28:18.844294700Z 2022-05-21 10:28:18.843 TRACE 1 --- [     parallel-1] s.c.g.f.ReactiveLoadBalancerClientFilter : ReactiveLoadBalancerClientFilter url before: lb://chat-composite/openapi/webjars/swagger-ui/swagger-ui-bundle.js
2022-05-21T10:28:18.849858800Z 2022-05-21 10:28:18.847 TRACE 1 --- [     parallel-1] s.c.g.f.ReactiveLoadBalancerClientFilter : LoadBalancerClientFilter url chosen: http://64885baa833a:8080/openapi/webjars/swagger-ui/swagger-ui-bundle.js
2022-05-21T10:28:18.856031600Z 2022-05-21 10:28:18.855 TRACE 1 --- [or-http-epoll-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [2c452163-1] HTTP GET "/openapi/webjars/swagger-ui/swagger-ui-standalone-preset.js", headers={masked}
2022-05-21T10:28:18.859541700Z 2022-05-21 10:28:18.859 TRACE 1 --- [or-http-epoll-2] o.s.c.gateway.filter.NettyRoutingFilter  : outbound route: a70962ea, inbound: [c4b942d2-1] 
2022-05-21T10:28:18.871453400Z 2022-05-21 10:28:18.870 TRACE 1 --- [     parallel-2] o.s.c.g.f.WeightCalculatorWebFilter      : Weights attr: {}
2022-05-21T10:28:18.883839600Z 2022-05-21 10:28:18.873 TRACE 1 --- [     parallel-2] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/chat-composite/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui-standalone-preset.js"
2022-05-21T10:28:18.883908100Z 2022-05-21 10:28:18.874 TRACE 1 --- [     parallel-2] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/oauth2/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui-standalone-preset.js"
2022-05-21T10:28:18.883931700Z 2022-05-21 10:28:18.874 TRACE 1 --- [     parallel-2] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/login/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui-standalone-preset.js"
2022-05-21T10:28:18.904988500Z 2022-05-21 10:28:18.875 TRACE 1 --- [     parallel-2] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/error/**]" does not match against value "/openapi/webjars/swagger-ui/swagger-ui-standalone-preset.js"
2022-05-21T10:28:18.905059300Z 2022-05-21 10:28:18.877 TRACE 1 --- [     parallel-2] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "/openapi/**" matches against value "/openapi/webjars/swagger-ui/swagger-ui-standalone-preset.js"
2022-05-21T10:28:18.905249000Z 2022-05-21 10:28:18.877 DEBUG 1 --- [     parallel-2] o.s.c.g.h.RoutePredicateHandlerMapping   : Route matched: chat-composite-swagger-ui
2022-05-21T10:28:18.905272700Z 2022-05-21 10:28:18.878 DEBUG 1 --- [     parallel-2] o.s.c.g.h.RoutePredicateHandlerMapping   : Mapping [Exchange: GET https://localhost:8443/openapi/webjars/swagger-ui/swagger-ui-standalone-preset.js] to Route{id='chat-composite-swagger-ui', uri=lb://chat-composite, order=0, predicate=Paths: [/openapi/**], match trailing slash: true, gatewayFilters=[], metadata={}}
2022-05-21T10:28:18.905324500Z 2022-05-21 10:28:18.878 DEBUG 1 --- [     parallel-2] o.s.c.g.h.RoutePredicateHandlerMapping   : [2c452163-1] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@183ff136
2022-05-21T10:28:18.905351700Z 2022-05-21 10:28:18.878 DEBUG 1 --- [     parallel-2] o.s.c.g.handler.FilteringWebHandler      : Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@2673487b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@6e948f1c}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@3de56885}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@194224ca}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@350f18a6}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@2d07aacc}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@2fb48970}, order = 10150], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@254e9709}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@4e8d9bb6}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@ff5d4f1}, order = 2147483647]]
2022-05-21T10:28:18.905425000Z 2022-05-21 10:28:18.878 TRACE 1 --- [     parallel-2] o.s.c.g.filter.RouteToRequestUrlFilter   : RouteToRequestUrlFilter start
2022-05-21T10:28:18.905445800Z 2022-05-21 10:28:18.878 TRACE 1 --- [     parallel-2] s.c.g.f.ReactiveLoadBalancerClientFilter : ReactiveLoadBalancerClientFilter url before: lb://chat-composite/openapi/webjars/swagger-ui/swagger-ui-standalone-preset.js
2022-05-21T10:28:18.905493300Z 2022-05-21 10:28:18.879 TRACE 1 --- [     parallel-2] s.c.g.f.ReactiveLoadBalancerClientFilter : LoadBalancerClientFilter url chosen: http://64885baa833a:8080/openapi/webjars/swagger-ui/swagger-ui-standalone-preset.js
2022-05-21T10:28:18.905525000Z 2022-05-21 10:28:18.903 TRACE 1 --- [or-http-epoll-3] o.s.c.gateway.filter.NettyRoutingFilter  : outbound route: 61ed3201, inbound: [2c452163-1] 
2022-05-21T10:28:18.917916100Z 2022-05-21 10:28:18.913 TRACE 1 --- [or-http-epoll-4] o.s.w.s.adapter.HttpWebHandlerAdapter    : [939ee057-3] Completed 200 OK, headers={masked}
2022-05-21T10:28:18.968565300Z 2022-05-21 10:28:18.952 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.NettyWriteResponseFilter  : NettyWriteResponseFilter start inbound: a70962ea, outbound: [c4b942d2-1] 
2022-05-21T10:28:18.968641900Z 2022-05-21 10:28:18.953 TRACE 1 --- [or-http-epoll-3] o.s.c.g.filter.NettyWriteResponseFilter  : NettyWriteResponseFilter start inbound: 61ed3201, outbound: [2c452163-1] 
2022-05-21T10:28:18.968665800Z 2022-05-21 10:28:18.953 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.GatewayMetricsFilter      : spring.cloud.gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=200),tag(outcome=SUCCESSFUL),tag(routeId=chat-composite-swagger-ui),tag(routeUri=lb://chat-composite),tag(status=OK)]
2022-05-21T10:28:19.121934200Z 2022-05-21 10:28:19.027 TRACE 1 --- [or-http-epoll-3] o.s.c.g.filter.GatewayMetricsFilter      : spring.cloud.gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=200),tag(outcome=SUCCESSFUL),tag(routeId=chat-composite-swagger-ui),tag(routeUri=lb://chat-composite),tag(status=OK)]
2022-05-21T10:28:19.471719300Z 2022-05-21 10:28:19.471 TRACE 1 --- [or-http-epoll-2] o.s.w.s.adapter.HttpWebHandlerAdapter    : [2c452163-1] Completed 200 OK, headers={masked}
2022-05-21T10:28:19.887287500Z 2022-05-21 10:28:19.878 TRACE 1 --- [or-http-epoll-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-1] Completed 200 OK, headers={masked}
2022-05-21T10:28:20.353473000Z 2022-05-21 10:28:20.353 TRACE 1 --- [or-http-epoll-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-2] HTTP GET "/openapi/v3/api-docs/swagger-config", headers={masked}
2022-05-21T10:28:20.357474900Z 2022-05-21 10:28:20.357 TRACE 1 --- [     parallel-3] o.s.c.g.f.WeightCalculatorWebFilter      : Weights attr: {}
2022-05-21T10:28:20.359609000Z 2022-05-21 10:28:20.359 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/chat-composite/**]" does not match against value "/openapi/v3/api-docs/swagger-config"
2022-05-21T10:28:20.359882000Z 2022-05-21 10:28:20.359 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/oauth2/**]" does not match against value "/openapi/v3/api-docs/swagger-config"
2022-05-21T10:28:20.360401000Z 2022-05-21 10:28:20.360 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/login/**]" does not match against value "/openapi/v3/api-docs/swagger-config"
2022-05-21T10:28:20.361139700Z 2022-05-21 10:28:20.360 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/error/**]" does not match against value "/openapi/v3/api-docs/swagger-config"
2022-05-21T10:28:20.361930900Z 2022-05-21 10:28:20.361 TRACE 1 --- [     parallel-3] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "/openapi/**" matches against value "/openapi/v3/api-docs/swagger-config"
2022-05-21T10:28:20.362281600Z 2022-05-21 10:28:20.362 DEBUG 1 --- [     parallel-3] o.s.c.g.h.RoutePredicateHandlerMapping   : Route matched: chat-composite-swagger-ui
2022-05-21T10:28:20.377665900Z 2022-05-21 10:28:20.364 DEBUG 1 --- [     parallel-3] o.s.c.g.h.RoutePredicateHandlerMapping   : Mapping [Exchange: GET https://localhost:8443/openapi/v3/api-docs/swagger-config] to Route{id='chat-composite-swagger-ui', uri=lb://chat-composite, order=0, predicate=Paths: [/openapi/**], match trailing slash: true, gatewayFilters=[], metadata={}}
2022-05-21T10:28:20.378023300Z 2022-05-21 10:28:20.377 DEBUG 1 --- [     parallel-3] o.s.c.g.h.RoutePredicateHandlerMapping   : [c4b942d2-2] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@183ff136
2022-05-21T10:28:20.394645500Z 2022-05-21 10:28:20.393 DEBUG 1 --- [     parallel-3] o.s.c.g.handler.FilteringWebHandler      : Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@2673487b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@6e948f1c}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@3de56885}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@194224ca}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@350f18a6}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@2d07aacc}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@2fb48970}, order = 10150], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@254e9709}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@4e8d9bb6}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@ff5d4f1}, order = 2147483647]]
2022-05-21T10:28:20.394694200Z 2022-05-21 10:28:20.393 TRACE 1 --- [     parallel-3] o.s.c.g.filter.RouteToRequestUrlFilter   : RouteToRequestUrlFilter start
2022-05-21T10:28:20.394702600Z 2022-05-21 10:28:20.394 TRACE 1 --- [     parallel-3] s.c.g.f.ReactiveLoadBalancerClientFilter : ReactiveLoadBalancerClientFilter url before: lb://chat-composite/openapi/v3/api-docs/swagger-config
2022-05-21T10:28:20.415089200Z 2022-05-21 10:28:20.395 TRACE 1 --- [     parallel-3] s.c.g.f.ReactiveLoadBalancerClientFilter : LoadBalancerClientFilter url chosen: http://64885baa833a:8080/openapi/v3/api-docs/swagger-config
2022-05-21T10:28:20.433535900Z 2022-05-21 10:28:20.429 TRACE 1 --- [or-http-epoll-3] o.s.c.gateway.filter.NettyRoutingFilter  : outbound route: 61ed3201, inbound: [c4b942d2-2] 
2022-05-21T10:28:20.457616300Z 2022-05-21 10:28:20.457 TRACE 1 --- [or-http-epoll-3] o.s.c.g.filter.NettyWriteResponseFilter  : NettyWriteResponseFilter start inbound: 61ed3201, outbound: [c4b942d2-2] 
2022-05-21T10:28:20.463107900Z 2022-05-21 10:28:20.462 TRACE 1 --- [or-http-epoll-3] o.s.c.g.filter.GatewayMetricsFilter      : spring.cloud.gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=200),tag(outcome=SUCCESSFUL),tag(routeId=chat-composite-swagger-ui),tag(routeUri=lb://chat-composite),tag(status=OK)]
2022-05-21T10:28:20.470349500Z 2022-05-21 10:28:20.469 TRACE 1 --- [or-http-epoll-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-2] Completed 200 OK, headers={masked}
2022-05-21T10:28:20.507352600Z 2022-05-21 10:28:20.506 TRACE 1 --- [or-http-epoll-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-3] HTTP GET "/openapi/v3/api-docs", headers={masked}
2022-05-21T10:28:20.513083200Z 2022-05-21 10:28:20.512 TRACE 1 --- [     parallel-4] o.s.c.g.f.WeightCalculatorWebFilter      : Weights attr: {}
2022-05-21T10:28:20.517904600Z 2022-05-21 10:28:20.517 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/chat-composite/**]" does not match against value "/openapi/v3/api-docs"
2022-05-21T10:28:20.519739000Z 2022-05-21 10:28:20.519 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/oauth2/**]" does not match against value "/openapi/v3/api-docs"
2022-05-21T10:28:20.520845100Z 2022-05-21 10:28:20.520 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/login/**]" does not match against value "/openapi/v3/api-docs"
2022-05-21T10:28:20.521781700Z 2022-05-21 10:28:20.521 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/error/**]" does not match against value "/openapi/v3/api-docs"
2022-05-21T10:28:20.535671600Z 2022-05-21 10:28:20.535 TRACE 1 --- [     parallel-4] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "/openapi/**" matches against value "/openapi/v3/api-docs"
2022-05-21T10:28:20.535770000Z 2022-05-21 10:28:20.535 DEBUG 1 --- [     parallel-4] o.s.c.g.h.RoutePredicateHandlerMapping   : Route matched: chat-composite-swagger-ui
2022-05-21T10:28:20.536073500Z 2022-05-21 10:28:20.535 DEBUG 1 --- [     parallel-4] o.s.c.g.h.RoutePredicateHandlerMapping   : Mapping [Exchange: GET https://localhost:8443/openapi/v3/api-docs] to Route{id='chat-composite-swagger-ui', uri=lb://chat-composite, order=0, predicate=Paths: [/openapi/**], match trailing slash: true, gatewayFilters=[], metadata={}}
2022-05-21T10:28:20.536320600Z 2022-05-21 10:28:20.536 DEBUG 1 --- [     parallel-4] o.s.c.g.h.RoutePredicateHandlerMapping   : [c4b942d2-3] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@183ff136
2022-05-21T10:28:20.536616000Z 2022-05-21 10:28:20.536 DEBUG 1 --- [     parallel-4] o.s.c.g.handler.FilteringWebHandler      : Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@2673487b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@6e948f1c}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@3de56885}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@194224ca}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@350f18a6}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@2d07aacc}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@2fb48970}, order = 10150], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@254e9709}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@4e8d9bb6}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@ff5d4f1}, order = 2147483647]]
2022-05-21T10:28:20.537474400Z 2022-05-21 10:28:20.537 TRACE 1 --- [     parallel-4] o.s.c.g.filter.RouteToRequestUrlFilter   : RouteToRequestUrlFilter start
2022-05-21T10:28:20.538885700Z 2022-05-21 10:28:20.537 TRACE 1 --- [     parallel-4] s.c.g.f.ReactiveLoadBalancerClientFilter : ReactiveLoadBalancerClientFilter url before: lb://chat-composite/openapi/v3/api-docs
2022-05-21T10:28:20.539195000Z 2022-05-21 10:28:20.538 TRACE 1 --- [     parallel-4] s.c.g.f.ReactiveLoadBalancerClientFilter : LoadBalancerClientFilter url chosen: http://64885baa833a:8080/openapi/v3/api-docs
2022-05-21T10:28:20.541667600Z 2022-05-21 10:28:20.541 TRACE 1 --- [or-http-epoll-2] o.s.c.gateway.filter.NettyRoutingFilter  : outbound route: a70962ea, inbound: [c4b942d2-3] 
2022-05-21T10:28:20.856769100Z 2022-05-21 10:28:20.856 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.NettyWriteResponseFilter  : NettyWriteResponseFilter start inbound: a70962ea, outbound: [c4b942d2-3] 
2022-05-21T10:28:20.858264800Z 2022-05-21 10:28:20.857 TRACE 1 --- [or-http-epoll-2] o.s.c.g.filter.GatewayMetricsFilter      : spring.cloud.gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=200),tag(outcome=SUCCESSFUL),tag(routeId=chat-composite-swagger-ui),tag(routeUri=lb://chat-composite),tag(status=OK)]
2022-05-21T10:28:20.862162000Z 2022-05-21 10:28:20.861 TRACE 1 --- [or-http-epoll-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-3] Completed 200 OK, headers={masked}
2022-05-21T10:28:26.810099500Z 2022-05-21 10:28:26.794 TRACE 1 --- [or-http-epoll-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-4] HTTP GET "/oauth2/authorize?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjarshttps%3A%2Flocalhost%3A8443%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=chat%3Aread%20chat%3Awrite&state=U2F0IE1heSAyMSAyMDIyIDEyOjI4OjI2IEdNVCswMjAwIChDZW50cmFsIEV1cm9wZWFuIFN1bW1lciBUaW1lKQ%3D%3D", headers={masked}
2022-05-21T10:28:26.810172200Z 2022-05-21 10:28:26.796 TRACE 1 --- [     parallel-1] o.s.c.g.f.WeightCalculatorWebFilter      : Weights attr: {}
2022-05-21T10:28:26.810184900Z 2022-05-21 10:28:26.798 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "[/chat-composite/**]" does not match against value "/oauth2/authorize"
2022-05-21T10:28:26.810192000Z 2022-05-21 10:28:26.799 TRACE 1 --- [     parallel-1] o.s.c.g.h.p.PathRoutePredicateFactory    : Pattern "/oauth2/**" matches against value "/oauth2/authorize"
2022-05-21T10:28:26.810199200Z 2022-05-21 10:28:26.799 DEBUG 1 --- [     parallel-1] o.s.c.g.h.RoutePredicateHandlerMapping   : Route matched: oauth2-server
2022-05-21T10:28:26.810627300Z 2022-05-21 10:28:26.800 DEBUG 1 --- [     parallel-1] o.s.c.g.h.RoutePredicateHandlerMapping   : Mapping [Exchange: GET https://localhost:8443/oauth2/authorize?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjarshttps%3A%2Flocalhost%3A8443%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=chat%3Aread%20chat%3Awrite&state=U2F0IE1heSAyMSAyMDIyIDEyOjI4OjI2IEdNVCswMjAwIChDZW50cmFsIEV1cm9wZWFuIFN1bW1lciBUaW1lKQ%3D%3D] to Route{id='oauth2-server', uri=lb://auth-server, order=0, predicate=Paths: [/oauth2/**], match trailing slash: true, gatewayFilters=[], metadata={}}
2022-05-21T10:28:26.811199600Z 2022-05-21 10:28:26.810 DEBUG 1 --- [     parallel-1] o.s.c.g.h.RoutePredicateHandlerMapping   : [c4b942d2-4] Mapped to org.springframework.cloud.gateway.handler.FilteringWebHandler@183ff136
2022-05-21T10:28:26.811785500Z 2022-05-21 10:28:26.811 DEBUG 1 --- [     parallel-1] o.s.c.g.handler.FilteringWebHandler      : Sorted gatewayFilterFactories: [[GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RemoveCachedBodyFilter@2673487b}, order = -2147483648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.AdaptCachedBodyGlobalFilter@6e948f1c}, order = -2147482648], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyWriteResponseFilter@3de56885}, order = -1], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardPathFilter@194224ca}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.GatewayMetricsFilter@350f18a6}, order = 0], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.RouteToRequestUrlFilter@2d07aacc}, order = 10000], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ReactiveLoadBalancerClientFilter@2fb48970}, order = 10150], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.WebsocketRoutingFilter@254e9709}, order = 2147483646], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.NettyRoutingFilter@4e8d9bb6}, order = 2147483647], [GatewayFilterAdapter{delegate=org.springframework.cloud.gateway.filter.ForwardRoutingFilter@ff5d4f1}, order = 2147483647]]
2022-05-21T10:28:26.812079400Z 2022-05-21 10:28:26.811 TRACE 1 --- [     parallel-1] o.s.c.g.filter.RouteToRequestUrlFilter   : RouteToRequestUrlFilter start
2022-05-21T10:28:26.814073700Z 2022-05-21 10:28:26.813 TRACE 1 --- [     parallel-1] s.c.g.f.ReactiveLoadBalancerClientFilter : ReactiveLoadBalancerClientFilter url before: lb://auth-server/oauth2/authorize?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjarshttps%3A%2Flocalhost%3A8443%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=chat%3Aread%20chat%3Awrite&state=U2F0IE1heSAyMSAyMDIyIDEyOjI4OjI2IEdNVCswMjAwIChDZW50cmFsIEV1cm9wZWFuIFN1bW1lciBUaW1lKQ%3D%3D
2022-05-21T10:28:27.063010800Z 2022-05-21 10:28:27.062 TRACE 1 --- [     parallel-1] s.c.g.f.ReactiveLoadBalancerClientFilter : LoadBalancerClientFilter url chosen: http://07721888c636:9999/oauth2/authorize?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjarshttps%3A%2Flocalhost%3A8443%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=chat%3Aread%20chat%3Awrite&state=U2F0IE1heSAyMSAyMDIyIDEyOjI4OjI2IEdNVCswMjAwIChDZW50cmFsIEV1cm9wZWFuIFN1bW1lciBUaW1lKQ%3D%3D
2022-05-21T10:28:27.095261600Z 2022-05-21 10:28:27.094 TRACE 1 --- [or-http-epoll-4] o.s.c.gateway.filter.NettyRoutingFilter  : outbound route: e6721659, inbound: [c4b942d2-4] 
2022-05-21T10:28:27.191227400Z 2022-05-21 10:28:27.190 TRACE 1 --- [or-http-epoll-4] o.s.c.g.filter.NettyWriteResponseFilter  : NettyWriteResponseFilter start inbound: e6721659, outbound: [c4b942d2-4] 
2022-05-21T10:28:27.208316900Z 2022-05-21 10:28:27.207 TRACE 1 --- [or-http-epoll-4] o.s.c.g.filter.GatewayMetricsFilter      : spring.cloud.gateway.requests tags: [tag(httpMethod=GET),tag(httpStatusCode=400),tag(outcome=CLIENT_ERROR),tag(routeId=oauth2-server),tag(routeUri=lb://auth-server),tag(status=BAD_REQUEST)]
2022-05-21T10:28:27.212761900Z 2022-05-21 10:28:27.212 TRACE 1 --- [or-http-epoll-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-4] Completed 400 BAD_REQUEST, headers={masked}
2022-05-21T10:28:27.442098700Z 2022-05-21 10:28:27.441 TRACE 1 --- [or-http-epoll-1] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-5] HTTP GET "/favicon.ico", headers={masked}
2022-05-21T10:28:27.507677300Z 2022-05-21 10:28:27.507 TRACE 1 --- [     parallel-3] o.s.w.s.adapter.HttpWebHandlerAdapter    : [c4b942d2-5] Completed 401 UNAUTHORIZED, headers={masked}
2022-05-21T10:32:05.667228300Z 2022-05-21 10:32:05.666  INFO 1 --- [trap-executor-0] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration

image

could you help me please?

2fa with Authorization server

Hi Magnus,

Great book firstly.
Is there a sample code that we can rely on for 2fa on the authorization server.

Regards

No operation detected

Hi, trying the openapi viewer i got an message saying that there is not operation in the spec. I change the packagesToScan as follow and it works:

packagesToScan: se.magnus

As the openapi operations are in the api project, openapi can not found any operations. Than you

Chapter 17

@magnus-larsson hello. I cloned your git and when in the folder chapter 17 and run the below command, it returns an error.

helm template kubernetes / helm / components / product --set envFromSecretRefs ="{rabbitmq-credentials, mongodb-credentials}"

Error: found in Chart.yaml, but missing in charts/ directory: common

Chapter-06 test classes fail on Mac Pro M1 chip machine

Hi dear author, I encountered an issue on the testing classes, belows are the fragment of error message:

o.t.d.DockerClientProviderStrategy : Could not find a valid Docker environment. Please check configuration. Attempted configurations were:

'/Users/user/Library/Caches/JNA/temp/jna3778529952029307024.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64e'))

I found there is issue on testcontainers repo Unable to run test containers with Apple Silicon Mac. The unit test works fine for me after adding testImplementation 'net.java.dev.jna:jna-platform:5.8.0' to gradle build file.

OAuth Client-Server

i finished building the authorization server and i'm trying now to build an oauth client-side server. i set the Configuration of the client server as follows:

app:
  eureka-username: u
  eureka-password: p
  eureka-server: localhost
  auth-server: localhost



eureka:
  client:
    serviceUrl:
      defaultZone: "http://${app.eureka-username}:${app.eureka-password}@${app.eureka-server}:8761/eureka/"
    initialInstanceInfoReplicationIntervalSeconds: 5
    registryFetchIntervalSeconds: 5
  instance:
    leaseRenewalIntervalInSeconds: 5
    leaseExpirationDurationInSeconds: 5

management.endpoint.health.show-details: "ALWAYS"
management.endpoints.web.exposure.include: "*"

spring:
  security:
    oauth2:
      client:
        registration:
          writer-client-oidc:
            provider: spring
            client-id: writer
            client-secret: secret
            authorization-grant-type: authorization_code
            redirect-uri: "https://localhost:8443/login/oauth2/code/writer-client-oidc"
            scope: openid
            client-name: writer-client-oidc
          writer-client-authorization-code:
            provider: spring
            client-id: writer
            client-secret: secret
            authorization-grant-type: authorization_code
            redirect-uri: "https://localhost:8443/authorized"
            scope: chart:write
            client-name: writer-client-authorization-code
          writer-client-client-credentials:
            provider: spring
            client-id: writer
            client-secret: secret
            authorization-grant-type: client_credentials
            scope: chart:write
            client-name: writer-client-client-credentials
        provider:
          spring:
            issuer-uri: http://${app.auth-server}:9999

I expected that with this Configuration i will be able to connect to the authorization server but i got that error:

Caused by: java.lang.IllegalArgumentException: Unable to resolve Configuration with the provided Issuer of "http://auth-server:9999"
2022-06-26T08:04:16.064768700Z 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.getBuilder(ClientRegistrations.java:221) ~[spring-security-oauth2-client-5.4.5.jar:5.4.5]
2022-06-26T08:04:16.064774200Z 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.fromIssuerLocation(ClientRegistrations.java:145) ~[spring-security-oauth2-client-5.4.5.jar:5.4.5]
2022-06-26T08:04:16.064779100Z 	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getBuilderFromIssuerIfPossible(OAuth2ClientPropertiesRegistrationAdapter.java:83) ~[spring-boot-autoconfigure-2.4.4.jar:2.4.4]
2022-06-26T08:04:16.064786000Z 	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getClientRegistration(OAuth2ClientPropertiesRegistrationAdapter.java:59) ~[spring-boot-autoconfigure-2.4.4.jar:2.4.4]
2022-06-26T08:04:16.064796800Z 	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.lambda$getClientRegistrations$0(OAuth2ClientPropertiesRegistrationAdapter.java:53) ~[spring-boot-autoconfigure-2.4.4.jar:2.4.4]
2022-06-26T08:04:16.064826800Z 	at java.base/java.util.HashMap.forEach(Unknown Source) ~[na:na]
2022-06-26T08:04:16.064833700Z 	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter.getClientRegistrations(OAuth2ClientPropertiesRegistrationAdapter.java:52) ~[spring-boot-autoconfigure-2.4.4.jar:2.4.4]
2022-06-26T08:04:16.064838900Z 	at org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientRegistrationRepositoryConfiguration.clientRegistrationRepository(OAuth2ClientRegistrationRepositoryConfiguration.java:49) ~[spring-boot-autoconfigure-2.4.4.jar:2.4.4]
2022-06-26T08:04:16.064844200Z 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
2022-06-26T08:04:16.064849100Z 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
2022-06-26T08:04:16.064853900Z 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
2022-06-26T08:04:16.064858600Z 	at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
2022-06-26T08:04:16.064863600Z 	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.5.jar:5.3.5]
2022-06-26T08:04:16.064868500Z 	... 80 common frames omitted
2022-06-26T08:04:16.064873300Z Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://auth-server:9999/.well-known/openid-configuration": auth-server; nested exception is java.net.UnknownHostException: auth-server
2022-06-26T08:04:16.064905700Z 	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:785) ~[spring-web-5.3.5.jar:5.3.5]
2022-06-26T08:04:16.064910900Z 	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:670) ~[spring-web-5.3.5.jar:5.3.5]
2022-06-26T08:04:16.064916100Z 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.lambda$oidc$0(ClientRegistrations.java:156) ~[spring-security-oauth2-client-5.4.5.jar:5.4.5]
2022-06-26T08:04:16.064921000Z 	at org.springframework.security.oauth2.client.registration.ClientRegistrations.getBuilder(ClientRegistrations.java:209) ~[spring-security-oauth2-client-5.4.5.jar:5.4.5]
2022-06-26T08:04:16.064928000Z 	... 92 common frames omitted
2022-06-26T08:04:16.064932900Z Caused by: java.net.UnknownHostException: auth-server
2022-06-26T08:04:16.064938500Z 

the configuration class:

@Configuration
public class WebClientConfig {

    @Bean
    @LoadBalanced
    WebClient webClient(OAuth2AuthorizedClientManager authorizedClientManager) {
        ServletOAuth2AuthorizedClientExchangeFilterFunction oauth2Client =
                new ServletOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager);
        return WebClient.builder()
                .apply(oauth2Client.oauth2Configuration())
                .build();
    }

    @Bean
    OAuth2AuthorizedClientManager authorizedClientManager(
            ClientRegistrationRepository clientRegistrationRepository,
            OAuth2AuthorizedClientRepository authorizedClientRepository) {

        OAuth2AuthorizedClientProvider authorizedClientProvider =
                OAuth2AuthorizedClientProviderBuilder.builder()
                        .authorizationCode()
                        .refreshToken()
                        .clientCredentials()
                        .build();
        DefaultOAuth2AuthorizedClientManager authorizedClientManager = new DefaultOAuth2AuthorizedClientManager(
                clientRegistrationRepository, authorizedClientRepository);
        authorizedClientManager.setAuthorizedClientProvider(authorizedClientProvider);

        return authorizedClientManager;
    }
}
@EnableWebSecurity
public class SecurityConfig {

    @Bean
    WebSecurityCustomizer webSecurityCustomizer() {
        return (web) -> web.ignoring().antMatchers("/webjars/**");
    }


    @Bean
    SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
        http
                .authorizeRequests(authorizeRequests ->
                        authorizeRequests.anyRequest().authenticated()
                )
                .oauth2Login(oauth2Login ->
                        oauth2Login.loginPage("/oauth2/authorization/writer-client-oidc"))
                .oauth2Client(withDefaults());
        return http.build();
    }

}

does anyone know why i get this error?

DuplicateKeyException is not thrown when I don't explicitly set "auto-index-creation" to true

When I build Chapter06 all tests pass and it is built successfully.
But when I do the same with my project, it won't pass the tests because spring data didn't throw DuplicateKeyException.
When I added this line:
auto-index-creation: true in the application.yml file, it finally resolved the issue as described in the here.
As far as I see, there is no difference between Chapter06 and my code.
Do you have any idea why this issue is happening to me?

Typo in p.153

in the page 153, it says:

"For the product and review microservices, which use MongoDB, a corresponding base class, MongoDbTestBase, has been added."

I believe this should be changed to:

"For the product and recommendation microservices, which use MongoDB, a corresponding base class, MongoDbTestBase, has been added."

Chapter 17. Implementing Kubernetes Features to Simplify the System Landscape | APPLICATION FAILED TO START | Config data resource 'file [/config-repo/product.yml]' via location 'file:/config-repo/product.yml' does not exist

Hello!

I am trying to create deployment for production and receiving an error:


$ kubectl logs product-7bb8dd5dbb-tnldm

***************************
APPLICATION FAILED TO START
***************************

Description:

Config data resource 'file [/config-repo/product.yml]' via location 'file:/config-repo/product.yml' does not exist

Action:

Check that the value 'file:/config-repo/product.yml' is correct, or prefix it with 'optional:'

I see that container just has no file.
Did I miss some step?

Do not want to manually update book sources.

===========================================


My Steps


$ unset KUBECONFIG

$ minikube start \
--profile=handson-spring-boot-cloud \
--memory=10240 \
--cpus=4 \
--disk-size=30g \
--kubernetes-version=v1.20.5 \
--driver=docker \
--ports=8080:80 --ports=8443:443 \
--ports=30080:30080 --ports=30443:30443

$ {
  minikube profile handson-spring-boot-cloud
  minikube addons enable ingress
  minikube addons enable metrics-server
}

$ eval $(minikube docker-env)
$ { 
  docker pull mysql:5.7.32
  docker pull mongo:4.4.2
  docker pull rabbitmq:3.8.11-management
  docker pull openzipkin/zipkin:2.23.2
}

Install the cert-manager


$ helm repo add jetstack https://charts.jetstack.io

$ helm repo update

$ helm install cert-manager jetstack/cert-manager \
--create-namespace \
--namespace cert-manager \
--version v1.3.1 \
--set installCRDs=true \
--wait

$ kubectl get pods --namespace cert-manager

NAME                                       READY   STATUS    RESTARTS   AGE
cert-manager-7998c69865-v6jrx              1/1     Running   0          43s
cert-manager-cainjector-7b744d56fb-ptqt5   1/1     Running   0          43s
cert-manager-webhook-7d6d4c78bc-6cztp      1/1     Running   0          43s

// Map minikube.me to the IP address we can use to reach the Minikube instance
$ sudo bash -c "echo $(minikube ip) minikube.me | tee -a /etc/hosts"

$ ./gradlew build && docker-compose build

// Resolving Helm chart dependencies
$ for f in kubernetes/helm/components/*; do helm dep up $f; done
$ for f in kubernetes/helm/environments/*; do helm dep up $f; done
$ helm dep ls kubernetes/helm/environments/prod-env/

NAME             	VERSION	REPOSITORY                               	STATUS
common           	1.0.0  	file://../../common                      	ok    
auth-server      	1.0.0  	file://../../components/auth-server      	ok    
product          	1.0.0  	file://../../components/product          	ok    
recommendation   	1.0.0  	file://../../components/recommendation   	ok    
review           	1.0.0  	file://../../components/review           	ok    
product-composite	1.0.0  	file://../../components/product-composite	ok    
zipkin-server    	1.0.0  	file://../../components/zipkin-server    	ok

$ kubectl config set-context $(kubectl config current-context) --namespace=hands-on

$ docker-compose up -d mongodb mysql rabbitmq

$ {
  docker tag hands-on/auth-server hands-on/auth-server:v1
  docker tag hands-on/product-composite-service hands-on/product-composite-service:v1
  docker tag hands-on/product-service hands-on/product-service:v1
  docker tag hands-on/recommendation-service hands-on/recommendation-service:v1
  docker tag hands-on/review-service hands-on/review-service:v1
}

$ helm install hands-on-prod-env \
kubernetes/helm/environments/prod-env \
-n hands-on --create-namespace \
--wait

$ kubectl get pods
NAME                                 READY   STATUS             RESTARTS   AGE
auth-server-6b7cf86b66-thnsl         0/1     CrashLoopBackOff   8          20m
product-7bb8dd5dbb-tnldm             0/1     CrashLoopBackOff   8          20m
product-composite-85fc98c8bf-s5j5v   0/1     CrashLoopBackOff   8          20m
recommendation-7c9bbd76f8-qbjcx      0/1     CrashLoopBackOff   8          20m
review-7b48469995-5jbqc              0/1     CrashLoopBackOff   8          20m
zipkin-server-6b9b4d988f-g78hq       1/1     Running            0          20m

=================


Environment

$ cat /etc/os-release | grep 'VERSION='
VERSION="20.04.4 LTS (Focal Fossa)"

$ java -version
java version "17.0.2" 2022-01-18 LTS

$ docker -v
Docker version 20.10.15, build fd82621

I updated gradle to work with JDK17

Error with code book! Help!

Hi magnus how are you? i am getting into the world of microservices and i am a newbie in back end. I started with your ebook which I think is great and I am very happy with how it is explained, but from chapter 7 I am having problems to raise the services with docker and I can not continue my learning because I could not find a solution on the internet to the following error when I run the following command.

cd $BOOK_HOME/Chapter07
./test-em-all.bash start

Sorry for my low knowledge but I can't follow the book with this error. I tried it on my pc with windows and wsl2 and also on a macbook pro but I get the same error.

thank you very much!
Untitled

Can not connect to Ryuk at localhost:32768

Im trying to run chapter 6 but i got an error:
Can not connect to Ryuk.

My system
Server Version: 20.10.24
API Version: 1.41
Operating System: Ubuntu Mantic Minotaur (development branch)
Total Memory: 15740 MB

Chapter 16. The test cannot be passed

Hello Magnus.
I ran into a problem in chapter 16, all the steps before the command "HOST=$MINIKUBE_HOST PORT=30443 USE_K8S=true ./test-em-all.bash" are running successfully, but when running the tests, 100 attempts are made to request "curl -k https://localhost:30443/actuator/health", and the test ends with the message Give up.
Where can I see what I'm doing wrong?

Help needed with Auth-Server configuration

Hi,

I followed the book by doing the coding in Kotlin so far. Everything works well, but now I'm stuck with the Auth-Server / Gateway configuration.

Authorization Code Grant Flow does not redirect to the login page

While the client credentials grant flow works and the integration test script runs green, I've problems getting the authorization code grant flow working.

Something is wrong with the redirect to the login form. It just doesn't work. When I open https://localhost:8443/oauth2/authorize?response_type=code&client_id=reader&redirect_uri=https://my.redirect.uri&scope=product:read&state=35725 in my browser, I immediately get a 401 with no content.

This is what I see in the logs of the auth-server:

hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:41:24.550 DEBUG 1 --- [io-9999-exec-10] o.s.security.web.FilterChainProxy        : Securing GET /oauth2/authorize?response_type=code&client_id=reader&redirect_uri=https://my.redirect.uri&scope=product:read&state=35725
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:41:24.551 DEBUG 1 --- [io-9999-exec-10] s.s.w.c.SecurityContextPersistenceFilter : Set SecurityContextHolder to empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:41:24.553 DEBUG 1 --- [io-9999-exec-10] o.s.s.w.s.HttpSessionRequestCache        : Loaded matching saved request https://localhost:8443/oauth2/authorize?response_type=code&client_id=reader&redirect_uri=https://my.redirect.uri&scope=product:read&state=35725
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:41:24.555 DEBUG 1 --- [io-9999-exec-10] o.s.s.w.a.AnonymousAuthenticationFilter  : Set SecurityContextHolder to anonymous SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:41:24.556 DEBUG 1 --- [io-9999-exec-10] o.s.s.w.a.i.FilterSecurityInterceptor    : Failed to authorize filter invocation [GET /oauth2/authorize?response_type=code&client_id=reader&redirect_uri=https://my.redirect.uri&scope=product:read&state=35725] with attributes [authenticated]
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:41:24.559 DEBUG 1 --- [io-9999-exec-10] o.s.s.w.s.HttpSessionRequestCache        : Saved request https://localhost:8443/oauth2/authorize?response_type=code&client_id=reader&redirect_uri=https://my.redirect.uri&scope=product:read&state=35725 to session
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:41:24.559 DEBUG 1 --- [io-9999-exec-10] w.c.HttpSessionSecurityContextRepository : Did not store empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:41:24.559 DEBUG 1 --- [io-9999-exec-10] s.s.w.c.SecurityContextPersistenceFilter : Cleared SecurityContextHolder to complete request

I can log in "manually" by directly going to https://localhost:8443/login. Given I've tried the oauth2 URL before after I'm successfully logged in, I'm immediately forwarded to the "consent required" page (does this come from a session?).

Authorization Code Grant Flow does not work with the Swagger UI

A similar problem exists when I want to authorize via the Swagger UI. After I click on the "Authorize" button, I end up on the login page. But after I enter the credentials, I get redirected to this error page https://localhost:8443/error?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=RnJpIEZlYiAxMSAyMDIyIDEzOjU3OjA4IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp

These are the logs from before the login:

hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.608 DEBUG 1 --- [nio-9999-exec-2] o.s.security.web.FilterChainProxy        : Securing GET /oauth2/authorize?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=VGh1IEZlYiAxMCAyMDIyIDE0OjU4OjA5IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.608 DEBUG 1 --- [nio-9999-exec-2] s.s.w.c.SecurityContextPersistenceFilter : Set SecurityContextHolder to empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.619 DEBUG 1 --- [nio-9999-exec-2] w.c.HttpSessionSecurityContextRepository : Did not store empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.619 DEBUG 1 --- [nio-9999-exec-2] w.c.HttpSessionSecurityContextRepository : Did not store empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.620 DEBUG 1 --- [nio-9999-exec-2] s.s.w.c.SecurityContextPersistenceFilter : Cleared SecurityContextHolder to complete request
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.624 DEBUG 1 --- [nio-9999-exec-2] o.s.security.web.FilterChainProxy        : Securing GET /error?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=VGh1IEZlYiAxMCAyMDIyIDE0OjU4OjA5IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.624 DEBUG 1 --- [nio-9999-exec-2] s.s.w.c.SecurityContextPersistenceFilter : Set SecurityContextHolder to empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.625 DEBUG 1 --- [nio-9999-exec-2] o.s.s.w.a.AnonymousAuthenticationFilter  : Set SecurityContextHolder to anonymous SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.626 DEBUG 1 --- [nio-9999-exec-2] o.s.s.w.session.SessionManagementFilter  : Request requested invalid session id 9EF2E16044FC6E6CACB4FAA563D9F62A
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.627 DEBUG 1 --- [nio-9999-exec-2] o.s.s.w.a.i.FilterSecurityInterceptor    : Failed to authorize filter invocation [GET /error?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=VGh1IEZlYiAxMCAyMDIyIDE0OjU4OjA5IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp] with attributes [authenticated]
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.653 DEBUG 1 --- [nio-9999-exec-2] o.s.s.w.s.HttpSessionRequestCache        : Saved request https://localhost:8443/error?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=VGh1IEZlYiAxMCAyMDIyIDE0OjU4OjA5IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp to session
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.655 DEBUG 1 --- [nio-9999-exec-2] o.s.s.web.DefaultRedirectStrategy        : Redirecting to https://localhost:8443/login
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.656 DEBUG 1 --- [nio-9999-exec-2] w.c.HttpSessionSecurityContextRepository : Did not store empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.658 DEBUG 1 --- [nio-9999-exec-2] w.c.HttpSessionSecurityContextRepository : Did not store empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.659 DEBUG 1 --- [nio-9999-exec-2] s.s.w.c.SecurityContextPersistenceFilter : Cleared SecurityContextHolder to complete request
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.704 DEBUG 1 --- [nio-9999-exec-3] o.s.security.web.FilterChainProxy        : Securing GET /login
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.705 DEBUG 1 --- [nio-9999-exec-3] s.s.w.c.SecurityContextPersistenceFilter : Set SecurityContextHolder to empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.718 DEBUG 1 --- [nio-9999-exec-3] w.c.HttpSessionSecurityContextRepository : Did not store empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.720 DEBUG 1 --- [nio-9999-exec-3] w.c.HttpSessionSecurityContextRepository : Did not store empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 13:58:10.721 DEBUG 1 --- [nio-9999-exec-3] s.s.w.c.SecurityContextPersistenceFilter : Cleared SecurityContextHolder to complete request

These are the logs from after the successful login:

hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:27.817 DEBUG 1 --- [nio-9999-exec-4] o.s.security.web.FilterChainProxy        : Securing POST /login
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:27.818 DEBUG 1 --- [nio-9999-exec-4] s.s.w.c.SecurityContextPersistenceFilter : Set SecurityContextHolder to empty SecurityContext
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.010 DEBUG 1 --- [nio-9999-exec-4] o.s.s.a.dao.DaoAuthenticationProvider    : Authenticated user
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.011 DEBUG 1 --- [nio-9999-exec-4] .s.ChangeSessionIdAuthenticationStrategy : Changed session id from EB63AC11489BB563F379EB0CCC4BA02B
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.012 DEBUG 1 --- [nio-9999-exec-4] o.s.s.w.csrf.CsrfAuthenticationStrategy  : Replaced CSRF Token
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.013 DEBUG 1 --- [nio-9999-exec-4] w.a.UsernamePasswordAuthenticationFilter : Set SecurityContextHolder to UsernamePasswordAuthenticationToken [Principal=org.springframework.security.core.userdetails.User [Username=username, Password=[PROTECTED], Enabled=true, AccountNonExpired=true, credentialsNonExpired=true, AccountNonLocked=true, Granted Authorities=[ROLE_USER]], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=172.30.0.1, SessionId=EB63AC11489BB563F379EB0CCC4BA02B], Granted Authorities=[ROLE_USER]]
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.015 DEBUG 1 --- [nio-9999-exec-4] o.s.s.web.DefaultRedirectStrategy        : Redirecting to https://localhost:8443/error?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=VGh1IEZlYiAxMCAyMDIyIDE0OjU4OjA5IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.016 DEBUG 1 --- [nio-9999-exec-4] w.c.HttpSessionSecurityContextRepository : Stored SecurityContextImpl [Authentication=UsernamePasswordAuthenticationToken [Principal=org.springframework.security.core.userdetails.User [Username=username, Password=[PROTECTED], Enabled=true, AccountNonExpired=true, credentialsNonExpired=true, AccountNonLocked=true, Granted Authorities=[ROLE_USER]], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=172.30.0.1, SessionId=EB63AC11489BB563F379EB0CCC4BA02B], Granted Authorities=[ROLE_USER]]] to HttpSession [org.apache.catalina.session.StandardSessionFacade@5dc28a79]
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.017 DEBUG 1 --- [nio-9999-exec-4] w.c.HttpSessionSecurityContextRepository : Stored SecurityContextImpl [Authentication=UsernamePasswordAuthenticationToken [Principal=org.springframework.security.core.userdetails.User [Username=username, Password=[PROTECTED], Enabled=true, AccountNonExpired=true, credentialsNonExpired=true, AccountNonLocked=true, Granted Authorities=[ROLE_USER]], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=172.30.0.1, SessionId=EB63AC11489BB563F379EB0CCC4BA02B], Granted Authorities=[ROLE_USER]]] to HttpSession [org.apache.catalina.session.StandardSessionFacade@5dc28a79]
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.017 DEBUG 1 --- [nio-9999-exec-4] s.s.w.c.SecurityContextPersistenceFilter : Cleared SecurityContextHolder to complete request
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.048 DEBUG 1 --- [nio-9999-exec-5] o.s.security.web.FilterChainProxy        : Securing GET /error?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=VGh1IEZlYiAxMCAyMDIyIDE0OjU4OjA5IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.049 DEBUG 1 --- [nio-9999-exec-5] w.c.HttpSessionSecurityContextRepository : Retrieved SecurityContextImpl [Authentication=UsernamePasswordAuthenticationToken [Principal=org.springframework.security.core.userdetails.User [Username=username, Password=[PROTECTED], Enabled=true, AccountNonExpired=true, credentialsNonExpired=true, AccountNonLocked=true, Granted Authorities=[ROLE_USER]], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=172.30.0.1, SessionId=EB63AC11489BB563F379EB0CCC4BA02B], Granted Authorities=[ROLE_USER]]]
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.050 DEBUG 1 --- [nio-9999-exec-5] s.s.w.c.SecurityContextPersistenceFilter : Set SecurityContextHolder to SecurityContextImpl [Authentication=UsernamePasswordAuthenticationToken [Principal=org.springframework.security.core.userdetails.User [Username=username, Password=[PROTECTED], Enabled=true, AccountNonExpired=true, credentialsNonExpired=true, AccountNonLocked=true, Granted Authorities=[ROLE_USER]], Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=172.30.0.1, SessionId=EB63AC11489BB563F379EB0CCC4BA02B], Granted Authorities=[ROLE_USER]]]
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.051 DEBUG 1 --- [nio-9999-exec-5] o.s.s.w.s.HttpSessionRequestCache        : Loaded matching saved request https://localhost:8443/error?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=VGh1IEZlYiAxMCAyMDIyIDE0OjU4OjA5IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.053 DEBUG 1 --- [nio-9999-exec-5] o.s.s.w.a.i.FilterSecurityInterceptor    : Authorized filter invocation [GET /error?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=VGh1IEZlYiAxMCAyMDIyIDE0OjU4OjA5IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp] with attributes [authenticated]
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.054 DEBUG 1 --- [nio-9999-exec-5] o.s.security.web.FilterChainProxy        : Secured GET /error?response_type=code&client_id=writer&redirect_uri=https%3A%2F%2Flocalhost%3A8443%2Fopenapi%2Fwebjars%2Fswagger-ui%2Foauth2-redirect.html&scope=product%3Aread%20product%3Awrite&state=VGh1IEZlYiAxMCAyMDIyIDE0OjU4OjA5IEdNVCswMTAwIChDZW50cmFsIEV1cm9wZWFuIFN0YW5kYXJkIFRpbWUp
hands-on-microservices-2nd-auth-server-1  | 2022-02-10 14:00:28.090 DEBUG 1 --- [nio-9999-exec-5] s.s.w.c.SecurityContextPersistenceFilter : Cleared SecurityContextHolder to complete request

As I've already pointed out I'm stuck here and grateful for any advice on either a solution or ideas on how to further debug this problem. 🙏

You can have a look at my current status of work / problem solving in my GH repo.

Regards,
Hauke

How to run WebTestClient test with debugger

Could you tell me how to run the WebTestClient test with the debugger? I mean if I want to debug RecommendationServiceImpl while running the test I put a stop point in the getRecommendationByProductId() test and in RecommendationServiceImpl, but when the test is run it does not go to RecommendationServiceImpl and I can not see how it works.

image
image

Persistence Test Fails

Hi,
Running Chapter06, build, Persistence Tests, fails:
This is based on the cloned version of chapter 6.

Chapter06> java --version
openjdk 11.0.16 2022-07-19
OpenJDK Runtime Environment Temurin-11.0.16+8 (build 11.0.16+8)
OpenJDK 64-Bit Server VM Temurin-11.0.16+8 (build 11.0.16+8, mixed mode)

Task :microservices:product-service:test

PersistenceTests > getByProductId() FAILED
java.lang.ExceptionInInitializerError at NativeConstructorAccessorImpl.java:-2
Caused by: org.testcontainers.containers.ContainerLaunchException at GenericContainer.java:330
Caused by: org.testcontainers.containers.ContainerFetchException at GenericContainer.java:1286
Caused by: org.testcontainers.containers.ContainerFetchException at RemoteDockerImage.java:97
Caused by: java.lang.InterruptedException at AbstractQueuedSynchronizer.java:1040

for Create, Delete, DuplicateError, getByProductId, optimisticLockError,paging, and update.

java.lang.NoClassDefFoundError: Could not initialize class se.magnus.microservices.core.product.PersistenceTests
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.junit.platform.commons.util.ReflectionUtils.newInstance(ReflectionUtils.java:513)
at org.junit.jupiter.engine.execution.ConstructorInvocation.proceed(ConstructorInvocation.java:56)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestClassConstructor(InvocationInterceptor.java:72)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:77)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestClassConstructor(ClassBasedTestDescriptor.java:342)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateTestClass(ClassBasedTestDescriptor.java:289)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:79)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:267)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$2(ClassBasedTestDescriptor.java:259)
at java.base/java.util.Optional.orElseGet(Optional.java:369)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$3(ClassBasedTestDescriptor.java:258)
at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:101)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:100)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:65)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$1(NodeTestTask.java:111)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:111)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:79)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at com.sun.proxy.$Proxy2.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:135)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:829)

Can't pass all tests in product-service

In ProductServiceApplicationTests.java, the following test failed:

  @Test
  void getProductInvalidParameterString() {

    client.get()
      .uri("/product/no-integer")
      .accept(APPLICATION_JSON)
      .exchange()
      .expectStatus().isEqualTo(BAD_REQUEST)
      .expectHeader().contentType(APPLICATION_JSON)
      .expectBody()
        .jsonPath("$.path").isEqualTo("/product/no-integer")
        .jsonPath("$.message").isEqualTo("Type mismatch.");
  }

From what I've been investigating so far, the InvalidParameterString is not handled in the current source code. Apparently, this test will fail for all chapters. Can you have a look?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.