All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.azbh111.starter.dev.PrintAllExampleProperties Maven / Gradle / Ivy

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);
            });
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy