Skip to content

Commit

Permalink
Docean-spring-starter needs to support multiple extension points (clo… (
Browse files Browse the repository at this point in the history
  • Loading branch information
sadadw1 authored Sep 21, 2023
2 parents 5e5c1d8 + 95bd677 commit ba6cdb3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion jcommon/docean-spring-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>run.mone</groupId>
<artifactId>jcommon</artifactId>
<version>1.4-SNAPSHOT</version>
<version>1.4-jdk20-SNAPSHOT</version>
</parent>

<artifactId>docean-spring-starter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand All @@ -38,16 +39,19 @@ public class DoceanAutoConfigure {

@PostConstruct
public void initConfig() {
List<String> list = Splitter.on(":").splitToList(extensionsConfig);
if (list.size() == 3) {
List<String> packageList = new ArrayList<>();
Splitter.on(",").splitToList(extensionsConfig).forEach(it -> {
List<String> list = Splitter.on(":").splitToList(extensionsConfig);
extensionMap.put(list.get(0), list.get(1));
ioc = Ioc.ins().name("extension").setContextFunction(name -> {
if (ac.containsBean(name)) {
return ac.getBean(name);
}
return Safe.callAndLog(() -> ac.getBean(Class.forName(name)), null);
}).init(list.get(2), "run.mone.docean.plugin.spring");
}
packageList.add(list.get(2));
});
packageList.add("run.mone.docean.plugin.spring");
ioc = Ioc.ins().name("extension").setContextFunction(name -> {
if (ac.containsBean(name)) {
return ac.getBean(name);
}
return Safe.callAndLog(() -> ac.getBean(Class.forName(name)), null);
}).init(packageList.toArray(new String[0]));
}


Expand Down
1 change: 1 addition & 0 deletions jcommon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
<module>excel</module>
<module>match</module>
<module>infra-common</module>
<module>docean-spring-starter</module>
</modules>
<distributionManagement>
<repository>
Expand Down

0 comments on commit ba6cdb3

Please sign in to comment.