Skip to content

JavaMelodyAutoConfiguration conditional on Servlet#1206

Merged
evernat merged 1 commit into
javamelody:masterfrom
candrews:patch-2
Feb 29, 2024
Merged

JavaMelodyAutoConfiguration conditional on Servlet#1206
evernat merged 1 commit into
javamelody:masterfrom
candrews:patch-2

Conversation

@candrews

Copy link
Copy Markdown
Contributor

JavaMelodyAutoConfiguration only works for servlet type web applications so it should be conditional on that application type.

Without this conditional, attempts to run a reactive application with the JavaMelody classes present fails to start with:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'monitoringSessionListener' defined in class path resource [net/bull/javamelody/JavaMelodyAutoConfiguration.class]: Unsatisfied dependency expressed through method 'monitoringSessionListener' parameter 0: No qualifying bean of type 'jakarta.servlet.ServletContext' available: expected at least 1 bean which qualifies as autowire candidate.

With this conditional, the application starts (without JavaMelody, of course).

JavaMelodyAutoConfiguration only works for servlet type web applications so it should be conditional on that application type.

Without this conditional, attempts to run a reactive application with the JavaMelody classes present fails to start with:
```
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'monitoringSessionListener' defined in class path resource [net/bull/javamelody/JavaMelodyAutoConfiguration.class]: Unsatisfied dependency expressed through method 'monitoringSessionListener' parameter 0: No qualifying bean of type 'jakarta.servlet.ServletContext' available: expected at least 1 bean which qualifies as autowire candidate.
```

With this conditional, the application starts (without JavaMelody, of course).
@evernat evernat merged commit 8f376db into javamelody:master Feb 29, 2024
@evernat

evernat commented Feb 29, 2024

Copy link
Copy Markdown
Member

thanks @candrews

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