Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to new Spring Boot auto configuration introduced in spring bo… #1778

Merged
merged 4 commits into from Sep 11, 2022

Conversation

aspan
Copy link
Contributor

@aspan aspan commented Aug 18, 2022

…ot 2.7. The existing spring.factories support will be removed in spring boot 3 so this will make sure that the autoconfiguration will still work in when upgrading to spring boot 3.

@remkop remkop added theme: compatibility Issues related to binary and source backwards compatibility theme: integration An issue or change related to integration with other frameworks, shells or operating systems labels Aug 18, 2022
@remkop
Copy link
Owner

remkop commented Aug 18, 2022

Hi @aspan, you mentioned that this new mechanism was introduced in Spring Boot 2.7, which was released only 3 months ago...

Will this new mechanism work with older versions of Spring (2.6.x and earlier)?

Is there any way to be compatible with both Spring 3.x and Spring 2.6.x and earlier?

@aspan
Copy link
Contributor Author

aspan commented Aug 19, 2022

I don't think there is a way to be backwards compatible with spring boot 2.6. The support has not been removed yet in spring boot 3 so it still works there. See. #29699 and #29698. So I think that there needs to be a separate module for spring 3 if your aim is to be backwards compatible with spring boot 2.6.

@remkop
Copy link
Owner

remkop commented Aug 21, 2022

I prefer not to have separate modules for Spring 2.6 and 2.7/3.x...

Would it be possible to support both mechanisms?

So, we don't remove picocli-spring-boot-starter/src/main/resources/META-INF/spring.factories --> this will allow it to work with Spring 2.6 and earlier

And we add picocli-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports --> this will allow it to work with Spring 2.7 and later

Can I ask you to test whether that approach would allow us to support both Spring 2.6 and 2.7/3.x?

@snicoll
Copy link
Contributor

snicoll commented Sep 10, 2022

We've had a similar request (registering the auto-configuration in both META-INF/spring.factories and the new location so that it works in both 2.x and 3.x. Picocli might be a good candidate as it relies on a small part of the Spring Boot API. Let me take that back to the team and I'll report back. Thanks!

Edit: actually I've just saw a comment that states it will work. So do not remove the entries in META-INF/spring.factories and add to the new location.

@remkop
Copy link
Owner

remkop commented Sep 10, 2022

Awesome, thank you @snicoll! 🙏😊

@remkop remkop added this to the 4.7 milestone Sep 10, 2022
@remkop
Copy link
Owner

remkop commented Sep 10, 2022

@aspan Will you be able to make these changes?

@aspan
Copy link
Contributor Author

aspan commented Sep 10, 2022

I'll make the changes today.

…ot 2.7. The existing spring.factories support will be removed in spring boot 3 so this will make sure that the autoconfiguration will still work in when upgrading to spring boot 3.
…annotation to @configuration(proxyBeanMethods = false) since @autoConfiguration is not available in spring boot 2.6.
@remkop remkop merged commit 4cc3355 into remkop:main Sep 11, 2022
@remkop
Copy link
Owner

remkop commented Sep 11, 2022

Merged. Thank you for the pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: compatibility Issues related to binary and source backwards compatibility theme: integration An issue or change related to integration with other frameworks, shells or operating systems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants