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

Fixed: Beans declared in TotpAutoConfiguration file are not created with Spring boot 3.2.1. #57

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

vinap
Copy link

@vinap vinap commented Jan 1, 2024

Error: Beans declared in TotpAutoConfiguration.java file are not created after with Spring 3.2.1.its throwing below error
image
''

Cause: The spring.factory file is deprecated in spring boot 2.7 and its completely removed in spring 3.2.1.

Fix: added dev.samstevens.totp.spring.autoconfigure.TotpAutoConfiguration entry in file
totp-spring-boot-starter/src/main/resources/META-INF/org.springframework.boot.autoconfigure.AutoConfiguration

Reference from spring doc:-
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#auto-configuration-files

Spring Boot 2.7 introduced a new META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports file for registering auto-configurations, while maintaining backwards compatibility with registration in spring.factories. With this release, support for registering auto-configurations in spring.factories using the org.springframework.boot.autoconfigure.EnableAutoConfiguration key has been removed in favor of the imports file. Other entries in spring.factories under other keys are unaffected.

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.7-Release-Notes#auto-configuration-registration

Auto-configuration Registration
If you have created your own auto-configurations, you should move the registration from spring.factories under the org.springframework.boot.autoconfigure.EnableAutoConfiguration key to a new file named META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports. Rather than a single comma-separate list, each line contains the fully qualified name of an auto-configuration class. See the included auto-configurations for an example.
For backwards compatibility, entries in spring.factories will still be honored.

vinap added 2 commits January 1, 2024 17:55
The spring.factories file is not working with spring boot 3.2.1.
Moved dev.samstevens.totp.spring.autoconfigure.TotpAutoConfiguration entry from spring.factories to AutoConfiguration file.
as Spring spring.factories is no more valid in spring boot 3.2.1
@vinap vinap changed the title Fixed: Beans declared in TotpAutoConfiguration file are not created after with Spring 3.2.1. Fixed: Beans declared in TotpAutoConfiguration file are not created with Spring boot 3.2.1. Jan 2, 2024
@eastack
Copy link

eastack commented Jul 10, 2024

Shouldn't the filename be org.springframework.boot.autoconfigure.AutoConfiguration.imports?

@Duncol
Copy link

Duncol commented Jul 25, 2024

Is this project still maintained?

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.

3 participants