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

site.sorghum.anno.plugin.PluginRunner Maven / Gradle / Ivy

The newest version!
package site.sorghum.anno.plugin;

import jakarta.inject.Named;
import site.sorghum.anno._common.AnnoBeanUtils;

import java.util.Comparator;
import java.util.List;

/**
 * 插件运行程序
 *
 * @author Sorghum
 * @since 2023/12/20
 */
@Named
public class PluginRunner {

    public volatile boolean init;

    public synchronized void init() {
        if (init){
            return;
        }
        List annoPlugins = AnnoBeanUtils.getBeansOfType(AnnoPlugin.class);
        annoPlugins.sort(Comparator.comparingInt(AnnoPlugin::runOrder).reversed());
        annoPlugins.forEach(AnnoPlugin::printPluginInfo);
        annoPlugins.forEach(AnnoPlugin::run);
        init = true;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy