Skip to content

Move configuration of optional bean to avoid ordering problem - #358

Merged
skjolber merged 1 commit into
masterfrom
moveConfiguration
Aug 28, 2026
Merged

skjolber merged 1 commit into
masterfrom
moveConfiguration

Conversation

@skjolber

@skjolber skjolber commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Error from abt-core in dev startup:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shutdownService': Unsatisfied dependency expressed through field 'grpcServerLifecycle': Error creating bean with name 'shadedNettyGrpcServerLifecycle' defined in class path resource [org/springframework/boot/grpc/server/autoconfigure/ShadedNettyGrpcServerConfiguration.class]: Unsatisfied dependency expressed through method 'shadedNettyGrpcServerLifecycle' parameter 0: Error creating bean with name 'shadedNettyGrpcServerFactory' defined in class path resource [org/springframework/boot/grpc/server/autoconfigure/ShadedNettyGrpcServerConfiguration.class]: Unsatisfied dependency expressed through method 'shadedNettyGrpcServerFactory' parameter 2: Error creating bean with name 'grpcServiceConfigurer' defined in class path resource [org/springframework/boot/grpc/server/autoconfigure/GrpcServerAutoConfiguration.class]: Error creating bean with name 'jwtSecurityFilterChain' defined in class path resource [org/entur/jwt/spring/grpc/netty/JwtGrpcAutoConfiguration.class]: Failed to instantiate [org.springframework.grpc.server.security.AuthenticationProcessInterceptor]: Factory method 'jwtSecurityFilterChain' threw exception with message: java.lang.IllegalStateException: JwtHeaderToIssuerMapper bean is required when 'entur.jwt.decode.header.map-to-issuer.enabled=true' but was not found in the application context

so seemingly a nested configuration does not wait for a optional bean in its parent configuration.

This changes ensures only a single configuration is involved (and thus a single order) for the above. Also maybe a more correct placement for the bean config.

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves optional JWT issuer-mapping beans into the web security configuration to address bean initialization ordering.

Changes:

  • Relocates mapper and decider bean definitions.
  • Injects both optional beans directly into the JWT filter-chain factory.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@skjolber
skjolber merged commit cfc015d into master Aug 28, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants