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

org.zodiac.plugin.factory.SprinBootServletPluginRegistryInfo Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.plugin.factory;

import java.util.Objects;

import org.pf4j.PluginManager;
import org.pf4j.PluginWrapper;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext;
import org.springframework.context.support.GenericApplicationContext;

public class SprinBootServletPluginRegistryInfo extends PluginRegistryInfo {

    protected SprinBootServletPluginRegistryInfo(PluginWrapper pluginWrapper, PluginManager pluginManager,
        GenericApplicationContext mainApplicationContext, boolean followingInitial) {
        super(pluginWrapper, pluginManager, mainApplicationContext, followingInitial);
    }

    @Override
    protected GenericApplicationContext obtainPluginApplicationContext() {
        /*生成插件ApplicationContext-DefaultListableBeanFactory*/
        DefaultListableBeanFactory defaultListableBeanFactory = new DefaultListableBeanFactory();
        GenericApplicationContext pluginApplicationContext = new AnnotationConfigServletWebServerApplicationContext(defaultListableBeanFactory);
        return pluginApplicationContext;
    }

    public static PluginRegistryInfo build(PluginWrapper pluginWrapper, PluginManager pluginManager,
        GenericApplicationContext parentApplicationContext, boolean followingInitial) {
        Objects.requireNonNull(pluginWrapper, "PluginWrapper can't is null");
        Objects.requireNonNull(pluginManager, "PluginManager can't is null");
        Objects.requireNonNull(parentApplicationContext, "parentApplicationContext can't is null");
        return new SprinBootServletPluginRegistryInfo(pluginWrapper, pluginManager, parentApplicationContext, followingInitial);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy