If the NATS-server is unavailable, running the application-server will still fail due to unrelated connection attempts even if it's disabled. We want to make sure setting "nats.enabled: false" means there is no connection to the NATS-server made at all.
Description
During Application Startup, there are connection attempts made regardless of the nats.enabled-setting. This PR adds an additional check to avoid initializing the @Bean for the NATS-server when nats.enabled is set to false.
Testing Instructions
Enter an invalid connection-string in application-local.yml -> nats.server and set nats.enabled to false.
Start the application-server and check if it starts without errors
Checklist
General
[x] PR title is clear and descriptive
[x] PR description explains the purpose and changes
[x] Code follows project coding standards
[x] Self-review of the code has been done
[x] Changes have been tested locally
Server (if applicable)
[x] Code is performant and follows best practices
[x] No security vulnerabilities introduced
[x] Proper error handling has been implemented
[ ] Added tests for new functionality
[ ] Changes have been tested in different environments (if applicable)
Motivation
If the NATS-server is unavailable, running the application-server will still fail due to unrelated connection attempts even if it's disabled. We want to make sure setting "nats.enabled: false" means there is no connection to the NATS-server made at all.
Description
During Application Startup, there are connection attempts made regardless of the
nats.enabled
-setting. This PR adds an additional check to avoid initializing the@Bean
for the NATS-server whennats.enabled
is set tofalse
.Testing Instructions
application-local.yml
->nats.server
and setnats.enabled
tofalse
.application-server
and check if it starts without errorsChecklist
General
Server (if applicable)