Search in sources :

Example 1 with PropertiesSources

use of com.tvd12.ezyhttp.server.core.annotation.PropertiesSources in project ezyhttp by youngmonkeys.

the class ApplicationContextBuilder method newBeanContextBuilder.

protected EzyBeanContextBuilder newBeanContextBuilder() {
    EzyBeanContextBuilder beanContextBuilder = EzyBeanContext.builder().addProperties(properties).addSingletons(singletonByName).addSingletonsByKey(singletonByKey);
    List<String> propertiesFiles = new ArrayList<>();
    propertiesFiles.addAll(Arrays.asList(DEFAULT_PROPERTIES_FILES));
    propertiesFiles.addAll(propertiesSources);
    for (String propertiesFile : propertiesFiles) {
        beanContextBuilder.addProperties(propertiesFile);
    }
    return beanContextBuilder;
}
Also used : EzyBeanContextBuilder(com.tvd12.ezyfox.bean.EzyBeanContextBuilder) ArrayList(java.util.ArrayList)

Example 2 with PropertiesSources

use of com.tvd12.ezyhttp.server.core.annotation.PropertiesSources in project ezyhttp by youngmonkeys.

the class ApplicationContextBuilder method addComponentClass.

public ApplicationContextBuilder addComponentClass(Class<?> componentClass) {
    ComponentsScan componentsScan = componentClass.getAnnotation(ComponentsScan.class);
    if (componentsScan != null) {
        scan(componentsScan.value().length != 0 ? componentsScan.value() : new String[] { componentClass.getPackage().getName() });
    }
    EzyPackagesToScan packagesToScan = componentClass.getAnnotation(EzyPackagesToScan.class);
    if (packagesToScan != null) {
        scan(packagesToScan.value().length != 0 ? packagesToScan.value() : new String[] { componentClass.getPackage().getName() });
    }
    ComponentClasses componentClasses = componentClass.getAnnotation(ComponentClasses.class);
    if (componentClasses != null) {
        addComponentClasses(componentClasses.value());
    }
    PropertiesSources propertiesSources = componentClass.getAnnotation(PropertiesSources.class);
    if (propertiesSources != null) {
        addPropertiesSources(propertiesSources.value());
    }
    this.componentClasses.add(componentClass);
    return this;
}
Also used : EzyPackagesToScan(com.tvd12.ezyfox.annotation.EzyPackagesToScan) ComponentClasses(com.tvd12.ezyhttp.server.core.annotation.ComponentClasses) PropertiesSources(com.tvd12.ezyhttp.server.core.annotation.PropertiesSources) ComponentsScan(com.tvd12.ezyhttp.server.core.annotation.ComponentsScan)

Aggregations

EzyPackagesToScan (com.tvd12.ezyfox.annotation.EzyPackagesToScan)1 EzyBeanContextBuilder (com.tvd12.ezyfox.bean.EzyBeanContextBuilder)1 ComponentClasses (com.tvd12.ezyhttp.server.core.annotation.ComponentClasses)1 ComponentsScan (com.tvd12.ezyhttp.server.core.annotation.ComponentsScan)1 PropertiesSources (com.tvd12.ezyhttp.server.core.annotation.PropertiesSources)1 ArrayList (java.util.ArrayList)1