:rocket:优化代码

This commit is contained in:
hello-hao
2023-03-20 18:06:00 +08:00
parent 8ebdbf6cee
commit c3e91f3593
7 changed files with 42 additions and 91 deletions
+10 -14
View File
@@ -41,21 +41,17 @@ public static void main(String[] args) {
@Bean
public static BeanFactoryPostProcessor dependsOnPostProcessor() {
return bf -> {
try{
// Let beans that need the database depend on the DatabaseStartupValidator
// like the JPA EntityManagerFactory or Flyway
String[] flyway = bf.getBeanNamesForType(FirstRun.class);
Stream.of(flyway)
.map(bf::getBeanDefinition)
.forEach(it -> it.setDependsOn("databaseStartupValidator"));
// Let beans that need the database depend on the DatabaseStartupValidator
// like the JPA EntityManagerFactory or Flyway
String[] flyway = bf.getBeanNamesForType(FirstRun.class);
Stream.of(flyway)
.map(bf::getBeanDefinition)
.forEach(it -> it.setDependsOn("databaseStartupValidator"));
String[] jpa = bf.getBeanNamesForType(KeysMapper.class);
Stream.of(jpa)
.map(bf::getBeanDefinition)
.forEach(it -> it.setDependsOn("databaseStartupValidator"));
}catch (Exception e){
System.out.println("错错错");
}
String[] jpa = bf.getBeanNamesForType(KeysMapper.class);
Stream.of(jpa)
.map(bf::getBeanDefinition)
.forEach(it -> it.setDependsOn("databaseStartupValidator"));
};
}