DeprecatedPropertyScanner

class DeprecatedPropertyScanner(scanningConfigProvider: <Error class: unknown class><DeprecatedPropertyScanningConfig>, propertyWarnerProvider: <Error class: unknown class><SimpleDeprecatedConfigWarner>, environment: <Error class: unknown class>)

Scans for deprecated @ConditionalOnProperty and @ConfigurationProperties annotations during application startup.

This component analyzes classes in configured packages to detect usage of deprecated properties in @ConditionalOnProperty and @ConfigurationProperties annotations, issuing warnings through the SimpleDeprecatedConfigWarner. Uses SmartInitializingSingleton to ensure all beans are fully available before scanning.

Conditional Bean Loading Scenarios

This scanner works with conditionally loaded beans based on migration configuration:

Scenario 1: Iteration 0 Default (Scanning Disabled)

# Default behavior - no scanning property set
# embabel.agent.platform.migration.scanning.enabled=false (implicit)
embabel.agent.platform.migration.warnings.enabled=true (default via matchIfMissing=true)

Bean State: scanningConfig = null, propertyWarner = available Behavior: Scanner logs "scanning disabled", no package scanning occurs Use Case: Iteration 0 production - warnings work, scanning deferred to Iteration 1

Scenario 2: Warnings Explicitly Disabled

embabel.agent.platform.migration.warnings.enabled=false
embabel.agent.platform.migration.scanning.enabled=false

Bean State: scanningConfig = null, propertyWarner = null Behavior: Scanner logs "migration system completely disabled" Use Case: Production environments that want to disable all migration detection

Scenario 3: Full Migration Detection (Iteration 1+)

embabel.agent.platform.migration.warnings.enabled=true
embabel.agent.platform.migration.scanning.enabled=true

Bean State: scanningConfig = available, propertyWarner = available Behavior: Full package scanning with conditional annotation detection Use Case: Iteration 1+ production - complete migration detection system active

Scenario 4: Warnings Only (Partial Detection)

embabel.agent.platform.migration.warnings.enabled=true
# embabel.agent.platform.migration.scanning.enabled=false (default)

Bean State: scanningConfig = null, propertyWarner = available Behavior: Property warnings work, but no @ConditionalOnProperty scanning Use Case: Users want property warnings but not bytecode scanning overhead

Rule Invocation Flow (When Fully Enabled)

The migration rules are automatically invoked during Spring application startup whenever deprecated conditional properties are detected in scanned classes:

Example Scenarios:

@ConditionalOnProperty Detection:

  • Scenario A: Direct Property - @ConditionalOnProperty("embabel.anthropic.max-attempts")

  • Scenario B: Prefix + Name - @ConditionalOnProperty(name = "max-attempts", prefix = "embabel.anthropic")

  • Scenario C: Prefix Only - @ConditionalOnProperty(prefix = "embabel.autonomy")

@ConfigurationProperties Detection:

  • Scenario D: Deprecated Prefix - @ConfigurationProperties(prefix = "embabel.autonomy")

  • Scenario E: Legacy Platform - @ConfigurationProperties("embabel.agent-platform.ranking")

  1. Spring startupafterSingletonsInstantiated() called after all beans initialized

  2. Bean availability check → Verifies both scanning config and property warner are available

  3. Package scanning → Finds classes in configured include packages (internal + external)

  4. Annotation detection → Finds @ConditionalOnProperty and @ConfigurationProperties annotations on classes

  5. Property extraction → Extracts property names from all annotation patterns:

    • @ConditionalOnProperty Direct: "embabel.anthropic.max-attempts"

    • @ConditionalOnProperty Prefix+Name: Combines to "embabel.anthropic.max-attempts"

    • @ConditionalOnProperty Prefix-Only: "embabel.autonomy"

    • @ConfigurationProperties Prefix: "embabel.autonomy"

  6. Deprecation checkisDeprecatedProperty() returns true for all deprecated patterns

  7. Warning generationgetRecommendedProperty() called with deprecated property name

  8. Transformation → Explicit mapping lookup returns new property name

  9. Warning issued → Logger warns about deprecated usage with recommended replacement property

See also

for scanning configuration options

for warning output format

Constructors

Link copied to clipboard
constructor(scanningConfigProvider: <Error class: unknown class><DeprecatedPropertyScanningConfig>, propertyWarnerProvider: <Error class: unknown class><SimpleDeprecatedConfigWarner>, environment: <Error class: unknown class>)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class PropertyMigrationRule(val pattern: Pattern, val replacement: String, val description: String, val condition: (String) -> Boolean? = null)

Data class representing a property migration rule with pattern matching.

Functions

Link copied to clipboard

Adds a new property migration rule at runtime. Useful for extending migration support without code changes.

Link copied to clipboard

Performs conditional property scanning after all singletons are initialized.

Link copied to clipboard

Gets all currently configured migration rules.

Link copied to clipboard
fun init()