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

net.hasor.solon.boot.SolonModule Maven / Gradle / Ivy

There is a newer version: 3.0.0-M3
Show newest version
package net.hasor.solon.boot;

import net.hasor.core.*;
import net.hasor.core.Module;
import org.noear.solon.Solon;

import java.util.function.Supplier;

public interface SolonModule extends Module {
    /**
     * 获取 SpringTypeSupplier
     */
    default TypeSupplier springTypeSupplier(ApiBinder apiBinder) {
        return new SolonTypeSupplier();
    }

    /**
     * 使用 Spring getBean(Class) 方式获取Bean。
     */
    default  Supplier getSupplierOfType(ApiBinder apiBinder, Class targetType) {
        return (Provider) () -> Solon.context().getBean(targetType);
    }

    /**
     * 使用 Spring getBean(String) 方式获取Bean。
     */
    default  Supplier getSupplierOfName(ApiBinder apiBinder, String beanName) {
        return (Provider) () -> (T) Solon.context().getBean(beanName);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy