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

fun.fengwk.convention4j.spring.cloud.starter.nacos.NacosCustomAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.1.14
Show newest version
package fun.fengwk.convention4j.spring.cloud.starter.nacos;

import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration;
import com.alibaba.cloud.nacos.util.InetIPv6Utils;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;

/**
 * @author fengwk
 */
@ConditionalOnClass(NacosDiscoveryProperties.class)
@AutoConfiguration
public class NacosCustomAutoConfiguration {

    @Bean
    public NacosRegistrationIpCorrector nacosRegistrationIpCorrector(
        NacosDiscoveryProperties nacosDiscoveryProperties,
        InetIPv6Utils inetIPv6Utils,
        InetUtils inetUtils,
        ApplicationEventPublisher applicationEventPublisher,
        Environment environment) {
        return new NacosRegistrationIpCorrector(nacosDiscoveryProperties,
            inetIPv6Utils, inetUtils, applicationEventPublisher, environment);
    }

    @Bean
    public NacosRegistrationOnlineEndpoint nacosRegistrationOnlineEndpoint(
        NacosAutoServiceRegistration nacosAutoServiceRegistration) {
        return new NacosRegistrationOnlineEndpoint(nacosAutoServiceRegistration);
    }

    @Bean
    public NacosRegistrationOfflineEndpoint nacosRegistrationOfflineEndpoint(
        NacosAutoServiceRegistration nacosAutoServiceRegistration) {
        return new NacosRegistrationOfflineEndpoint(nacosAutoServiceRegistration);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy