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

META-INF.spring-launcher.groovy Maven / Gradle / Ivy


import org.springframework.boot.context.config.ConfigFileApplicationListener

import org.zodiac.commons.util.Classes
import org.zodiac.core.launcher.configurer.SpringBootApplicationLauncherConfigurer

/**
 * Default implementation of {@link IBootstrappingConfigurer}
 */
class FeignGroovySpringLauncherConfigurer implements SpringBootApplicationLauncherConfigurer {

    @Override
    def int getOrder() {
        return -100
    }

    @Override
    def Properties defaultProperties() {
        def defaultProperties = new Properties()

        def location = new StringBuffer()
        /*
         * The conventional for feign.
         * According to different heterogeneous runtime environments (multi RPC frameworks),
         * automatically identify and contain different configuration directories.
         * */
        if (Classes.isPresent("org.springframework.cloud.openfeign.FeignClient") && Classes.isPresent("org.springframework.cloud.openfeign.FeignAutoConfiguration")) {
            location.append(",classpath:/scf/").append(",classpath:/META-INF/scf/")
        } else if (Classes.isPresent("org.zodiac.feign.core.annotation.FeignConsumer")) {
            location.append(",classpath:/sbf/").append(",classpath:/META-INF/sbf/")
        }
        /*Preset 'spring.config.additional-location', external resources does not override resources in classpath.*/
        defaultProperties.put(ConfigFileApplicationListener.CONFIG_ADDITIONAL_LOCATION_PROPERTY, location.toString())

        return defaultProperties
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy