Skip to content

Add SpringBootTransformer for merging Spring Boot configuration files#1936

Closed
Copilot wants to merge 9 commits intomainfrom
copilot/add-new-transformer-for-1489
Closed

Add SpringBootTransformer for merging Spring Boot configuration files#1936
Copilot wants to merge 9 commits intomainfrom
copilot/add-new-transformer-for-1489

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Spring Boot resource files (e.g., spring.factories, *.imports) are silently overwritten when multiple JARs are combined into a shadow JAR, breaking auto-configuration discovery. This adds a dedicated SpringBootTransformer that merges these files correctly.

Changes

  • New SpringBootTransformer extends PatternFilterableResourceTransformer (same pattern as ServiceFileTransformer) and handles the following resource files:
    • META-INF/spring.factories — comma-separated class lists; merged by appending values per key
    • META-INF/spring.handlers / spring.schemas / spring.tooling / spring-autoconfigure-metadata.properties — merged the same way
    • META-INF/spring/*.imports (Spring Boot 3+) — deduplicated line-per-class merge
  • Relocation-aware: dot-notation values (class names) use relocateClass; slash-notation values (resource paths, e.g. in spring.schemas) use relocatePath
  • @CacheableTransformer annotated; state tracked via @Internal maps
  • Default PatternSet covers all Spring Boot resource paths; users can customize includes/excludes via the inherited PatternFilterable API

Usage

tasks.shadowJar {
    transform(SpringBootTransformer::class.java)
    // optionally with relocation
    relocate("com.example", "shadow.example")
}
  • CHANGELOG's "Unreleased" section has been updated, if applicable.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 27, 2026 12:21
Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
Copilot AI changed the title [WIP] Add new transformer to handle #1489 Add SpringBootTransformer for merging Spring Boot configuration files Feb 27, 2026
@Goooler
Copy link
Member

Goooler commented Feb 27, 2026

@copilot Simplify this by PatternFilterableResourceTransformer

…Transformer

Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 27, 2026

@copilot Simplify this by PatternFilterableResourceTransformer

Done in 259d7d0. SpringBootTransformer now extends PatternFilterableResourceTransformer with a default PatternSet (like ServiceFileTransformer), removing the @Inject/ObjectFactory constructor, the canTransformResource() override, and the internal PROPERTIES_PATHS set.

@Goooler
Copy link
Member

Goooler commented Mar 1, 2026

It's so complex. I'll leave it closed for now.

@Goooler Goooler closed this Mar 1, 2026
@Goooler Goooler deleted the copilot/add-new-transformer-for-1489 branch March 1, 2026 10:35
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