org.cattleframework.cloud.discovery.polaris.PolarisCloudDiscoveryProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cattle-cloud-discovery-starter-polaris Show documentation
Show all versions of cattle-cloud-discovery-starter-polaris Show documentation
Cattle framework cloud discovery component for polaris pom
The newest version!
/*
* Copyright (C) 2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.cattleframework.cloud.discovery.polaris;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.cattleframework.cloud.discovery.BaseCloudDiscoveryProperties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.core.env.Environment;
/**
* Polaris服务发现属性配置
*
* @author orange
*
*/
@ConfigurationProperties("cattle.cloud.discovery.polaris")
public class PolarisCloudDiscoveryProperties extends BaseCloudDiscoveryProperties {
@Value("${spring.cloud.polaris.discovery.namespace:${spring.cloud.polaris.namespace:default}}")
private String namespace;
public String getNamespace() {
return namespace;
}
public void setNamespace(String namespace) {
this.namespace = namespace;
}
@Override
protected void overrideFromEnv(Environment environment) {
if (StringUtils.isBlank(getAddress())) {
setAddress(environment.resolvePlaceholders("${spring.cloud.polaris.address:}"));
}
if (isRegisterEnabled() == null) {
setRegisterEnabled(BooleanUtils
.toBoolean(environment.resolvePlaceholders("${spring.cloud.polaris.discovery.register:true}")));
}
}
}