mirror of
https://gitee.com/dcren/initializr.git
synced 2025-07-15 23:13:30 +08:00
Make sure ProjectDescriptionDiff is created eagerly
This commit makes sure that the diff instance is created immediately, taking a snapshot of the ProjectDescription before the customizers are applied on it. Previously, the instance was created as part of the supplier and therefore created only once a component was requiring it. See gh-1023
This commit is contained in:
parent
591f6885cb
commit
6c261fd8f1
@ -123,7 +123,10 @@ public class ProjectGenerator {
|
||||
MutableProjectDescription mutableDescription = (MutableProjectDescription) description;
|
||||
ProjectDescriptionDiffFactory diffFactory = context.getBeanProvider(ProjectDescriptionDiffFactory.class)
|
||||
.getIfAvailable(DefaultProjectDescriptionDiffFactory::new);
|
||||
context.registerBean(ProjectDescriptionDiff.class, () -> diffFactory.create(mutableDescription));
|
||||
// Create the diff here so that it takes a copy of the description
|
||||
// immediately
|
||||
ProjectDescriptionDiff diff = diffFactory.create(mutableDescription);
|
||||
context.registerBean(ProjectDescriptionDiff.class, () -> diff);
|
||||
context.getBeanProvider(ProjectDescriptionCustomizer.class).orderedStream()
|
||||
.forEach((customizer) -> customizer.customize(mutableDescription));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user