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

io.github.dengchen2020.ip.config.IpAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 0.0.30
Show newest version
package io.github.dengchen2020.ip.config;

import io.github.dengchen2020.ip.properties.IpBuilder;
import io.github.dengchen2020.ip.service.IpService;
import io.github.dengchen2020.ip.service.impl.xdb.IpXdbServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * ip查询配置
 * @author dengchen
 * @since 2023/5/6
 */
@PropertySource("classpath:application-ip.properties")
@EnableConfigurationProperties(IpBuilder.class)
@Configuration(proxyBeanMethods = false)
public class IpAutoConfiguration {

    private final IpBuilder ipBuilder;

    public IpAutoConfiguration(IpBuilder ipBuilder) {
        this.ipBuilder = ipBuilder;
    }

    @ConditionalOnMissingBean
    @Bean
    public IpService ipService(){
        return new IpXdbServiceImpl(ipBuilder.getWindows().getLocation(),ipBuilder.getLinux().getLocation());
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy