com.github.azbh111.starter.dev.PrintAllExampleProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of app-config-spring-boot-starter Show documentation
Show all versions of app-config-spring-boot-starter Show documentation
com.github.azbh111:app-config-spring-boot-starter
The newest version!
package com.github.azbh111.starter.dev;
import com.github.azbh111.utils.java.charset.Charsets;
import com.github.azbh111.utils.java.io.IOUtils;
import com.github.azbh111.utils.java.resource.ResourceUtils;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
import java.util.function.Consumer;
/**
* 提取所有starter中的配置
*
* @author: zyp
* @date: 2020/10/15 3:34 下午
*/
public class PrintAllExampleProperties {
public static void main(String... args) throws IOException {
print(null);
}
public static void print(Consumer printer) throws IOException {
if (printer == null) {
printer = str -> System.out.println(str);
}
Consumer printer_ = printer;
Enumeration urls = ResourceUtils.getResources(PrintAllExampleProperties.class, "default-properties/application.properties");
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
IOUtils.readLineLarge(url, Charsets.UTF_8, str -> {
if (!str.contains("=")) {
return;
}
printer_.accept(str);
});
}
}
}