Skip to content

Comments

Add Spring XML bean config vs annotation-driven pattern (Enterprise category)#59

Merged
brunoborges merged 2 commits intomainfrom
copilot/add-spring-patterns
Feb 20, 2026
Merged

Add Spring XML bean config vs annotation-driven pattern (Enterprise category)#59
brunoborges merged 2 commits intomainfrom
copilot/add-spring-patterns

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

Spring's traditional XML-based bean wiring is verbose and error-prone compared to Spring Boot's annotation-driven auto-configuration. This adds a new Enterprise pattern illustrating the contrast.

Changes

  • New pattern content/enterprise/spring-xml-config-vs-annotations.json (id=110)
    • Old: XML <bean> declarations in applicationContext.xml
    • Modern: @SpringBootApplication + stereotype annotations (@Service, @Repository) + constructor injection
    • Labels: Spring (XML)Spring Boot 3+
  • Navigation chain: updated jdbc-resultset-vs-jpa-criteria.json next pointer to the new pattern

Example

Old (XML wiring):

<bean id="userService" class="com.example.UserService">
    <property name="repository" ref="userRepository"/>
</bean>

Modern (annotation-driven):

@Service
public class UserService {
    private final UserRepository repository;

    public UserService(UserRepository repository) {
        this.repository = repository;
    }
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Add new patterns for Spring</issue_title>
<issue_description>Spring Framework 4 is an old school version that requires a lot of XML for bean configuration.

But Spring Framework 5 and now 7 (latest), everything can be done with annotations. Add a slug for the new approach versus the old approach of spring bean definition.

Place under category Enterprise</issue_description>

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add new patterns for Spring Framework annotations Add Spring XML bean config vs annotation-driven pattern (Enterprise category) Feb 20, 2026
Copilot AI requested a review from brunoborges February 20, 2026 07:57
@brunoborges brunoborges marked this pull request as ready for review February 20, 2026 08:01
@brunoborges brunoborges merged commit 3de40d8 into main Feb 20, 2026
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.

Add new patterns for Spring

2 participants