Skip to content

fix: resolve Druid monitoring page 404 after Spring Boot 3 upgrade#239

Merged
unknowIfGuestInDream merged 2 commits intomasterfrom
copilot/fix-druid-monitoring-404
Feb 28, 2026
Merged

fix: resolve Druid monitoring page 404 after Spring Boot 3 upgrade#239
unknowIfGuestInDream merged 2 commits intomasterfrom
copilot/fix-druid-monitoring-404

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

Druid monitoring page returns 404 because GenAutoConfig used @EnableAutoConfiguration(exclude=...) on a @ConditionalOnProperty class. Auto-configuration exclusions can be processed regardless of whether the bean condition passes, so DruidDataSourceAutoConfigure (and its @Import of DruidStatViewServletConfiguration) was always excluded—the monitoring servlet was never registered.

Proposed Changes

  1. GenApplication — Move DataSourceAutoConfiguration and DruidDataSourceAutoConfigure exclusions to @SpringBootApplication(exclude=...) for unconditional, reliable exclusion. Both are unnecessary: DataSourceConfig handles manual DataSource creation when gen.isdb=true.
  2. Remove GenAutoConfig — Its only purpose was the exclusion, which is now on the main class.
  3. Add DruidMonitorConfig — Manually registers Jakarta-based StatViewServlet and WebStatFilter when gen.isdb=true, reading config from DruidStatProperties. This replaces the registration that was previously expected from the now-excluded auto-configuration.
  4. Fix RemoveDruidAdConfig — Remove @AutoConfigureAfter and @ConditionalOnBean (no-ops on non-auto-config classes); add @EnableConfigurationProperties(DruidStatProperties.class) for direct property access.

Readiness Checklist

Author/Contributor

  • If documentation is needed for this change, has that been included in this pull request

Reviewing Maintainer

  • Label as either enhancement, bug, documentation, style or dependencies
  • Verify design and implementation

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.2/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-e937359de4103e32/dbs/java/working/files-to-index13432678823468386474.list --sourceArchiveDir=/tmp/codeql-scratch-e937359de4103e32/dbs/java/src --outputDir=/tmp/codeql-scratch-e937359de4103e32/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature Request] druid监控地址访问404</issue_title>
<issue_description>### Checklist

  • I searched exising issues and no one else requests similar feature.
  • I think that 25%+ users are positive towards this feature.

Describe the feature

升级后页面进去druid监控页时404,请修复

Additional context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@naming-conventions-bot
Copy link

Thank you for following naming conventions! 😻

@mergify
Copy link

mergify bot commented Feb 28, 2026

Thanks for opening this pull request!
Please check out the Contributing Guidelines.

@mergify
Copy link

mergify bot commented Feb 28, 2026

@Copilot
Wrong PR Title: [WIP] Fix 404 error on druid monitoring page
Please check Contributing Guidelines for more information.

…ewServlet and WebStatFilter

Move auto-configuration exclusions from conditional GenAutoConfig to
@SpringBootApplication to ensure they are always applied reliably.
Add DruidMonitorConfig to manually register the Jakarta-based
StatViewServlet and WebStatFilter when gen.isdb=true, bypassing
the excluded DruidDataSourceAutoConfigure.
Fix RemoveDruidAdConfig by removing @AutoConfigureAfter and
@ConditionalOnBean which don't work for non-auto-configuration classes.

Co-authored-by: unknowIfGuestInDream <57802425+unknowIfGuestInDream@users.noreply.github.com>
@what-the-diff
Copy link

what-the-diff bot commented Feb 28, 2026

PR Summary

  • Streamlined GenApplication.java: Adjustments were made to this file to avoid potential conflicts during the setup process.

  • Introduced DruidMonitorConfig.java: A new file has been introduced to handle monitoring operations, improving web assessment capabilities.

  • Removed GenAutoConfig.java: The removal of this configuration file helps simplify code management by eliminating redundant disabling procedures.

  • Refined RemoveDruidAdConfig.java: Modifications were done to this file to clean up and optimize its structure. It continues to manage the clearing of unwanted promotional material from web monitoring page.

@sonarqubecloud
Copy link

Copilot AI changed the title [WIP] Fix 404 error on druid monitoring page fix: resolve Druid monitoring page 404 after Spring Boot 3 upgrade Feb 28, 2026
@mergify mergify bot added the bug Something isn't working label Feb 28, 2026
@unknowIfGuestInDream unknowIfGuestInDream marked this pull request as ready for review February 28, 2026 07:56
@github-actions github-actions bot added the enhancement New feature or request label Feb 28, 2026
@unknowIfGuestInDream unknowIfGuestInDream merged commit 1d441dd into master Feb 28, 2026
94 checks passed
@unknowIfGuestInDream unknowIfGuestInDream deleted the copilot/fix-druid-monitoring-404 branch February 28, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] druid监控地址访问404

2 participants