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

Spring Boot 2 vs. Spring Boot 3 - auto-configuration incompatibility #130

Open
cer opened this issue Jan 11, 2023 · 8 comments
Open

Spring Boot 2 vs. Spring Boot 3 - auto-configuration incompatibility #130

cer opened this issue Jan 11, 2023 · 8 comments

Comments

@cer
Copy link
Contributor

cer commented Jan 11, 2023

Originally posted by @cer in #129 (comment)

auto-configuration is not working currently in SB3 because the file has been moved to a new location and with a new name, spring-projects/spring-boot#32566

  • Spring Boot 2 - spring.factories
  • Spring Boot 3 - org.springframework.boot.autoconfigure.AutoConfiguration.imports

/cc @kwonglau

@cer
Copy link
Contributor Author

cer commented Jan 11, 2023

@kwonglau Isn't the solution to simply have both files: spring.factories and org.springframework.boot.autoconfigure.AutoConfiguration.imports?

@kwonglau
Copy link

yes.

auto configuration issue is an easy fix.

@kwonglau
Copy link

The configuration class in org.springframework.boot.autoconfigure.AutoConfiguration.imports has to mark as @AutoConfiguration instead of @Configuration. Otherwise; it will not pick up in spring boot 3.

https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfiguration.java

the annotation exists since 2.7.

@cer
Copy link
Contributor Author

cer commented Jul 26, 2023

The configuration class in org.springframework.boot.autoconfigure.AutoConfiguration.imports has to mark as @AutoConfiguration instead of @Configuration. Otherwise; it will not pick up in spring boot 3.

Are you saying that auto configuration of Eventuate applications is not working because of this problem?

One possibility is to update the framework to require 2.7. That's currently the only (non-commercial) supported 2.x version

@kwongpan
Copy link

Correct. The auto config class doesn’t pick up in spring 3.1.1 unless I use the new annotation.

@cer
Copy link
Contributor Author

cer commented Jul 27, 2023

Correct. The auto config class doesn’t pick up in spring 3.1.1 unless I use the new annotation.

I just tried an example (which uses autoconfiguration via the eventuate starters) with 3.1.2 and the build worked (locally): See eventuate-tram/eventuate-tram-sagas-examples-customers-and-orders@3706088

There also this open Spring Boot issue: spring-projects/spring-boot#35044

@cer
Copy link
Contributor Author

cer commented Jul 28, 2023

Very strange. I had an autoconfiguration failure on a really small (private) project. I fixed it by changing Tram to use @autoConfiguration.

@kwongpan
Copy link

I think the behavior is unpredictable. I recall that it was working when I was testing it with spring boot 3.0.1 back in January and it didn’t work when I was testing with spring boot 3.1.1 a few days ago.

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

No branches or pull requests

3 participants