- Notifications
You must be signed in to change notification settings - Fork100
2.7: Changes to Auto-configuration #156#182
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
2.7: Changes to Auto-configuration #156#182
Uh oh!
There was an error while loading.Please reload this page.
Conversation
pivotal-cla commentedJun 30, 2022
@ijusti Please sign theContributor License Agreement! Click here to manually synchronize the status of this Pull Request. See theFAQ for frequently asked questions. |
pivotal-cla commentedJun 30, 2022
@ijusti Thank you for signing theContributor License Agreement! |
...nts/sbm-core/src/main/java/org/springframework/sbm/build/impl/OpenRewriteMavenBuildFile.javaShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Hi@ijusti! |
| } | ||
| @Override | ||
| publicbooleanevaluate(ProjectContextcontext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Could you use e.g.PathPatternMatchingProjectResourceFinder instead?
This would also remove the dependency fromCondition toAction and remove the assumption that the resources in theProjectContext exist as files.
return !context.search(new PathPatternMatchingProjectResourceFinder("**/src/main/resources/META-INF/spring.factories")).isEmpty();There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
i need to check that near spring.factories no new file exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You're right, that's a good idea. What about something like this?
return !context.search(new PathPatternMatchingProjectResourceFinder("**/src/main/resources/META-INF/spring.factories")).isEmpty() && context.search(new PathPatternMatchingProjectResourceFinder("**/src/main/resources/META-INF/org.springframework.boot.autoconfigure.AutoConfiguration.imports")).isEmpty()There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this good, and I tried to make this way? but there is no spring.factories in context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
something like this, that mean that there is no new imports near spring.factories
return context.search(new PathPatternMatchingProjectResourceFinder("**/src/main/resources/META-INF/spring.factories")).stream().anyMatch(resource-> context.search(new PathPatternMatchingProjectResourceFinder("resource.path.parent +"org.springframework.boot.autoconfigure.AutoConfiguration.imports")).isEmpty())There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Ah, I got your valid point here.
I am thinking that if we replace all old with new factories in one go and remove the old ones (or move withMoveFilesAction), there should not be both (old and new) in one project. If this is "guaranteed" we can skip the second part of the check?
You could replaceresource.path.parent withresource.getAbsoluetPath().getParent().resolve("org.springframework.boot.autoconfigure.AutoConfiguration.imports") and then useAbsolutePathResourceFinder with this path.
...ngframework/sbm/boot/upgrade_24_25/actions/Boot_24_25_CreateDatasourceInitializerAction.javaShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
.../java/org/springframework/sbm/boot/upgrade_24_25/actions/Boot_24_25_UpgradeReportAction.javaShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
| importstaticjava.nio.file.StandardOpenOption.WRITE; | ||
| importstaticjava.util.function.Predicate.not; | ||
| publicclassCreateAutoconfigurationActionextendsAbstractAction { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Please provide a test for this class.
You can create a syntheticProjectContext withTestProjectContext helper class.
Run the Action against the createdProjectConetxt and verify the result.
You can have a look at existing tests for examples.
.../java/org/springframework/sbm/boot/upgrade/common/actions/CreateAutoconfigurationAction.javaShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
...nents/sbm-recipes-boot-upgrade/src/main/resources/recipes/boot-autoconfiguration-update.yamlShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
| } | ||
| @Override | ||
| publicbooleanevaluate(ProjectContextcontext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You're right, that's a good idea. What about something like this?
return !context.search(new PathPatternMatchingProjectResourceFinder("**/src/main/resources/META-INF/spring.factories")).isEmpty() && context.search(new PathPatternMatchingProjectResourceFinder("**/src/main/resources/META-INF/org.springframework.boot.autoconfigure.AutoConfiguration.imports")).isEmpty()Hi@ijusti ! |
No description provided.