Skip to content

Refactor dependency organization and naming in Sentinel POMs#37

Open
mercyblitz wants to merge 41 commits into
microsphere-projects:release-1.xfrom
mercyblitz:dev-1.x
Open

Refactor dependency organization and naming in Sentinel POMs#37
mercyblitz wants to merge 41 commits into
microsphere-projects:release-1.xfrom
mercyblitz:dev-1.x

Conversation

@mercyblitz

Copy link
Copy Markdown
Contributor

This pull request makes significant updates to the project's GitHub workflows, documentation, and branch management to align with the new microsphere-alibaba-sentinel naming and branching strategy. It removes legacy workflows, updates build and publish configurations for new branches and Java/Spring Cloud versions, and refines release note generation. The README and badges are also updated to reflect the new repository name and modules.

Branching and Workflow Updates:

  • Updated build and publish workflows to use dev-1.x and release-1.x branches instead of main, dev, and release, and adjusted Java and Spring Cloud version matrices for compatibility. (.github/workflows/maven-build.yml, .github/workflows/maven-publish.yml) [1] [2] [3]
  • Removed legacy workflows: the automatic main-to-branches merge, upstream branch sync, and wiki documentation publish workflows, simplifying CI and branch management. (.github/workflows/merge-main-to-branches.yml, .github/workflows/sync-branches-from-upstream.yml, .github/workflows/wiki-publish.yml) [1] [2] [3]
  • Updated the release branch merge step to merge release-1.x into dev-1.x instead of release into main. (.github/workflows/maven-publish.yml)

Documentation and Project Naming:

  • Renamed all references from microsphere-sentinel to microsphere-alibaba-sentinel in the README, Maven artifact names, badges, and module descriptions for consistency with the new project name. (README.md) [1] [2] [3] [4] [5]
  • Updated Codecov and Maven build slugs to match the new repository name. (.github/workflows/maven-build.yml, README.md) [1] [2]

Release Note Improvements:

  • Enhanced the release notes generator to include new sections for documentation, dependency updates, test improvements, and build/workflow enhancements, and always append a full changelog link. (.github/workflows/maven-publish.yml) [1] [2]

These changes ensure the repository and CI workflows are consistent with the new naming conventions and branch strategy, and improve release automation and documentation clarity.

Standardize dependency ordering across sentinel plugin POMs.

- Add a "Third-Party Dependencies" section/comment in multiple POMs (alibaba-druid, hibernate-core, p6spy, redis) to clarify grouping.
- In microsphere-alibaba-sentinel-alibaba-druid/pom.xml: move com.alibaba:druid into the Third-Party section and remove the <optional>true</optional> from io.github.microsphere-projects:microsphere-alibaba-druid-core.
- In microsphere-alibaba-sentinel-mybatis/pom.xml: move io.github.microsphere-projects:microsphere-mybatis-core earlier (grouped with project dependencies) and remove the duplicate block later.

These changes are cosmetic/organizational to improve consistency and readability of dependency sections across the sentinel plugin modules.
In microsphere-alibaba-sentinel-redis/pom.xml remove the <optional>true</optional> element from the io.github.microsphere-projects:microsphere-redis-spring dependency so it is treated as a normal (non-optional) dependency and will be transitively included for consumers.
Refactor multiple Sentinel plugin modules: rename generic Constants interfaces to specific Sentinel*Constants (alibaba-druid, hibernate, mybatis, p6spy, redis, spring-web) and update related imports and tests. Rename SentinelDruidFilter to SentinelAlibabaDruidFilter and update the service registration. Adjust usages across code and tests to match new class names, including callback and interceptor references. Update spring-boot module pom.xml to add dependencies for sentinel plugin modules, related optional integrations and test/libs (Hibernate, Druid, Redis, MyBatis, microsphere test modules, H2, Lettuce) and switch to JUnit Jupiter for testing. Enhance SentinelAutoConfiguration to import/register Redis and MyBatis configurations (add conditional annotations and imports) and add new tests for auto-configuration (RedisConfig and SentinelAutoConfigurationTest). Overall cleanup to align naming conventions and wire new module dependencies.
Delete RedisContextConfig.java from the microsphere-alibaba-sentinel-redis test sources. This removed the test configuration that declared RedisContext (bean name RedisContext.BEAN_NAME) and RedisConfiguration (bean name RedisConfiguration.BEAN_NAME).
@augmentcode

augmentcode Bot commented Jun 5, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Refactors naming and dependency organization across multiple Microsphere Sentinel integration modules, and updates Spring Boot wiring/tests.

Changes:

  • Renamed per-plugin generic Constants interfaces to Sentinel*Constants and updated imports/usages in Druid, Hibernate, MyBatis, P6Spy, Redis, and Spring Web plugins.
  • Renamed the Alibaba Druid filter implementation to SentinelAlibabaDruidFilter and updated the Druid SPI service entry plus related tests.
  • Reorganized several plugin POM dependency sections (Microsphere vs third-party) and adjusted optional flags on some dependencies.
  • Expanded the Spring Boot module POM to include individual Sentinel integration modules (Druid/Hibernate/MyBatis/Redis) and switched the direct JUnit dependency to JUnit Jupiter.
  • Implemented Redis/MyBatis nested auto-configurations gated by @ConditionalOnProperty/@ConditionalOnClass and enable-annotations.
  • Added Spring Boot integration tests plus a Redis test configuration to exercise the auto-configuration path.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

"org.springframework.data.redis.connection.RedisConnection",
"io.microsphere.redis.spring.interceptor.RedisConnectionInterceptor"
})
@EnableRedisInterceptor

@augmentcode augmentcode Bot Jun 5, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

microsphere-alibaba-sentinel-spring-boot/.../SentinelAutoConfiguration.java:42 @EnableRedisInterceptor (and similarly @EnableMyBatis) comes from dependencies that are marked <optional>true</optional> in the Spring Boot POM, so consumers may hit NoClassDefFoundError when this auto-config is loaded. Because these nested configs are referenced via @Import(Class...), the class literals can be resolved before @ConditionalOnClass has a chance to guard missing optional types.

Other locations where this applies: microsphere-alibaba-sentinel-spring-boot/src/main/java/io/microsphere/alibaba/sentinel/spring/boot/autoconfigure/SentinelAutoConfiguration.java:54.

Severity: high

Other Locations
  • microsphere-alibaba-sentinel-spring-boot/src/main/java/io/microsphere/alibaba/sentinel/spring/boot/autoconfigure/SentinelAutoConfiguration.java:54

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

<scope>test</scope>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<optional>true</optional>

@augmentcode augmentcode Bot Jun 5, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

microsphere-alibaba-sentinel-spring-boot/pom.xml:143 org.junit.jupiter:junit-jupiter is declared without <scope>test</scope> and with <optional>true</optional>, which effectively makes it a compile dependency while also not being brought transitively to downstream projects. This is likely intended to be test-scoped so the published artifact doesn’t leak JUnit onto consumers’ main classpaths.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.


@Bean
public static RedisConnectionFactory redisConnectionFactory() {
LettuceConnectionFactory redisConnectionFactory = new LettuceConnectionFactory("127.0.0.1", 6379);

@augmentcode augmentcode Bot Jun 5, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

microsphere-alibaba-sentinel-spring-boot/.../RedisConfig.java:53 This test config hard-codes Redis at 127.0.0.1:6379 and then eagerly calls validateConnection(), so unit tests will fail in CI/dev environments where Redis isn’t running locally. Consider using an embedded/mocked Redis for tests, or deferring/avoiding connection validation during context startup.

Severity: high

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Update the root parent POM and the shared BOM version property to Microsphere Spring Cloud 0.1.21 so the project aligns with the newer upstream dependency set.
Updates the parent POM BOM property for `microsphere-alibaba-druid` from `0.1.16` to `0.1.24` to align dependency management with the newer Druid integration release.
Update the parent BOM property in `microsphere-alibaba-sentinel-parent/pom.xml` to use `microsphere-mybatis` version `0.1.12` instead of `0.1.9`, aligning dependency management with the newer MyBatis integration release.
Update the parent POM to use microsphere-redis 0.1.9 so the project picks up the latest Redis integration changes and fixes from that dependency release.
Set `microsphere-alibaba-druid.version` back from `0.1.24` to `0.1.17` in the parent POM, aligning this module with the intended Druid dependency version.
Update the parent Maven BOM to use microsphere-hibernate 0.1.6 so downstream modules pick up the latest Hibernate integration changes.
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...l/spring/cloud/SentinelCloudAutoConfiguration.java 88.23% 1 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ Complexity Δ
...sphere/alibaba/sentinel/common/SentinelPlugin.java 100.00% <ø> (ø) 4.00 <0.00> (?)
...here/alibaba/sentinel/common/SentinelTemplate.java 100.00% <ø> (ø) 11.00 <0.00> (?)
.../alibaba/sentinel/common/SimpleSentinelPlugin.java 100.00% <100.00%> (ø) 5.00 <1.00> (?)
...re/alibaba/sentinel/common/util/SentinelUtils.java 94.28% <100.00%> (ø) 17.00 <2.00> (?)
...baba/sentinel/jmx/JMXSentinelPluginRepository.java 97.77% <ø> (ø) 22.00 <0.00> (?)
...inel/alibaba/druid/SentinelAlibabaDruidFilter.java 96.29% <100.00%> (ø) 14.00 <1.00> (?)
...ernate/entity/SentinelHibernateEntityCallback.java 88.37% <ø> (ø) 20.00 <0.00> (?)
...ybatis/executor/SentinelMyBatisExecutorFilter.java 93.75% <ø> (ø) 9.00 <0.00> (?)
...baba/sentinel/p6spy/SentinelJdbcEventListener.java 97.22% <ø> (ø) 20.00 <0.00> (?)
.../redis/spring/SentinelRedisCommandInterceptor.java 100.00% <ø> (ø) 18.00 <0.00> (?)
... and 6 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mercyblitz added 17 commits July 2, 2026 22:57
Centralized Sentinel enabled-property metadata in `SentinelConstants` (including a shared default value) and updated plugin constants to reuse it. Introduced `@ConditionalOnSentinelAvailiable` to separate classpath availability from property checks, then updated auto-configuration to use the new condition and explicit plugin property names for Redis/MyBatis toggles. Also added the optional microsphere annotation processor dependency required for configuration property annotations.
Clean up import and static import ordering in the commons and plugin modules to keep the codebase consistent with the project's formatting conventions. No functional behavior is changed.
Update the parent POM to use microsphere-redis 0.1.10 instead of 0.1.9, aligning the project with the latest microsphere-redis release.
Add a static import for `ENABLED_PROPERTY_VALUE` in `SentinelSpringWebConstants` to align with common Sentinel constants usage and prepare/clean up centralized property value references.
Rename `ConditionalOnSentinelAvailiable` to `ConditionalOnSentinelAvailable` and update `SentinelAutoConfiguration` imports/usages accordingly. This corrects the spelling in the public annotation type and keeps auto-configuration wiring aligned.
Replaces the monolithic `SentinelAutoConfiguration` with dedicated Spring Boot auto-configurations for Alibaba Druid, MyBatis, and Redis, and updates auto-configuration registration files accordingly. The change also tightens Sentinel availability conditions, adds/aligns optional module dependencies in POMs, and updates related tests (including explicit Druid filter wiring) to match the new bootstrap model.
Update SentinelRedisAutoConfiguration class documentation to include a @see link to Spring Boot's RedisAutoConfiguration, clarifying the related auto-configuration dependency context.
Introduce `SentinelWebAutoConfiguration` to auto-register `SentinelHandlerMethodInterceptor` for web applications when Sentinel is enabled and required classes are present. Register the new auto-configuration in both `spring.factories` and `AutoConfiguration.imports`, and update tests to use `@SpringBootTest` with a web environment so web auto-config can be loaded. The module POM now includes the Spring Boot web/testing and Microsphere web MVC/WebFlux test dependencies needed for this coverage.
Introduce `SentinelAlibabaDruidAutoConfigurationTest` to validate default bean creation and negative conditions for disabled properties and missing classes. Also add `assertj-core` as a test-scoped dependency in the Spring Boot module to support fluent assertions used by the new tests.
Introduce a reusable `AutoConfigurationTest` base class for Spring Boot auto-configuration tests, including shared setup and helper assertions for disabled properties and missing classes. Refactor the Druid auto-configuration test to extend this base and also assert the nested `Config` bean by default. Add a new `SentinelMyBatisAutoConfigurationTest` covering default bean registration, property-based disablement, and classpath-conditional behavior.
Update the JavaDoc for `SENTINEL_MYBATIS_ENABLED_PROPERTY_NAME` to explicitly include the full configuration key (`microsphere.sentinel.mybatis.enabled`), making the plugin enablement property easier to identify.
Clean up `SentinelMyBatisAutoConfigurationTest` by deleting locally duplicated helper methods for disabled-property and filtered-class assertions. The test now relies on shared support from the base test infrastructure, and the now-unused `FilteredClassLoader` import is removed.
Updated the Druid and MyBatis Spring Boot auto-configuration tests to reference `this.autoConfigurationClass` instead of hardcoding concrete auto-configuration classes in assertions. This keeps the tests aligned with the shared `AutoConfigurationTest` base contract and reduces duplication when validating disabled properties and missing-class conditions.
Update `SentinelRedisConstants` JavaDoc to explicitly include the full property key (`microsphere.sentinel.redis.enabled`) for the Redis plugin enabled flag, improving discoverability and configuration clarity.
Move `@ConditionalOnRedisAvailable` from the nested `Config` class to `SentinelRedisAutoConfiguration` so the entire auto-configuration is gated when Redis is unavailable. This prevents loading the auto-config container when Redis conditions are not met.
Removes the direct `@EnableRedisInterceptor` annotation and class-condition dependency from `SentinelRedisAutoConfiguration`, so activation relies on existing conditional checks instead of explicit interceptor enabling. Adds `SentinelRedisAutoConfigurationTest` to cover default bean registration, disabling properties, and missing-class scenarios for Redis Sentinel auto-configuration.
Renames `SentinelWebAutoConfiguration` to `SentinelSpringWebAutoConfiguration`, fixes it to use the Spring Web enable property, and adds a Spring Web class guard so it only activates in valid web contexts. Updates both auto-configuration registration files and introduces a dedicated `SentinelSpringWebAutoConfigurationTest`.

Refactors the shared auto-configuration test base to cover both regular and web application contexts with common global disabled-property and missing-class assertions, then adapts the Druid/MyBatis/Redis tests to the new extension points. Minor constant/autoconfiguration Javadoc text was also clarified.
mercyblitz added 14 commits July 4, 2026 20:33
Remove the local RedisConfig test class and switch SentinelAutoConfigurationTest to import io.microsphere.redis.spring.test.config.RedisConfig. This deduplicates Redis test setup and aligns the test with the common Redis test configuration.
Clean up Javadoc formatting in the Sentinel Alibaba Druid and Sentinel MyBatis auto-configuration classes by removing extra leading whitespace in the class descriptions. This keeps comment style consistent across Spring Boot auto-config sources.
Switch Druid, Hibernate, and P6Spy integrations to use `SimpleSentinelPlugin` auto-installation by passing `autoInstalled=true`, and remove redundant manual `install(this)` calls. Also rename the constructor flag in `SimpleSentinelPlugin` from `autoRegisterMBean` to `autoInstalled` to align with the behavior.
Switch Druid, Hibernate, and P6Spy integrations to explicit plugin installation by constructing `SimpleSentinelPlugin` with auto-install disabled and then calling `SentinelPlugin.install(this)`. Add `SentinelUtils.resetContextMap()` (via `ContextUtil.resetContextMap`) and register shutdown cleanup, then update tests to reset Sentinel context between runs and assert Druid context behavior consistently when enabled or disabled.
Update `SentinelHibernateEntityCallbackTest` to add an `@AfterEach` check that enters the default Sentinel context, verifies the entrance node is created, and exits the context. This strengthens test coverage around Sentinel context initialization/cleanup behavior in Hibernate integration tests.
Enhance `SentinelMyBatisExecutorFilterTest` with an `@AfterEach` check that enters the default Sentinel context and asserts the entrance node has child nodes. This validates that mapper execution is producing Sentinel node records across test runs, including when toggling filter enablement.
Extend `SentinelJdbcEventListenerTest` with an `@AfterEach` check that enters the default Sentinel context/origin and verifies the entrance node has child nodes. This strengthens the test by asserting JDBC listener execution leaves expected Sentinel node state, then exits the context to keep cleanup explicit.
Replace the module-local Redis test configuration with `microsphere-redis-spring-test` by adding it as a test dependency and updating imports accordingly, then remove the duplicated `RedisConfig` class. The interceptor test also now asserts Sentinel context node creation after Redis operations, strengthening verification that command interception is being recorded in Sentinel.
Extend `SentinelHandlerMethodInterceptorTest` with a post-test assertion that enters the default Sentinel web context and verifies the entrance node has child nodes. This strengthens coverage by confirming requests create Sentinel node links and that context lifecycle cleanup still works.
Introduce a new `microsphere-alibaba-sentinel-spring-cloud` module and register it in the root reactor build. The new module centralizes Spring Cloud-related Sentinel dependencies (including optional integrations for Druid, Hibernate, MyBatis, Redis, WebMVC, and WebFlux) and adds Spring Boot auto-configuration metadata placeholders. As part of the split, WebMVC/WebFlux test dependencies were removed from the Spring Boot module to align responsibilities.
Update `microsphere-alibaba-sentinel-spring-cloud/pom.xml` to use the correct Maven coordinates for `hibernate-core` by changing the groupId from `org.hibernate.orm` to `org.hibernate`. This aligns dependency resolution with the expected artifact namespace.
Update `SentinelAlibabaDruidFilterTest` to replace pattern matching `instanceof` with a classic `instanceof` check plus explicit cast before assertions. This keeps the test behavior unchanged while improving compatibility with environments that do not support newer Java syntax.
Introduce `SentinelCloudAutoConfiguration` to expose Sentinel plugin capabilities as Spring Cloud `HasFeatures`, including named features for enabled plugins and abstract features for disabled ones. Register the auto-configuration for both `spring.factories` and Boot 3 `AutoConfiguration.imports`, add optional Spring Cloud commons/context dependencies, and add a Spring Boot test to verify feature bean creation and `FeaturesEndpoint` integration.
Improve readability of `ConditionalOnSentinelAvailable` by renaming the Javadoc section heading to “Example Usage” and adding inline comments that explain the two `@ConditionalOnClass` dependencies (Sentinel core API and Microsphere commons API).
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.

1 participant