1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

Fix code format error.

This commit is contained in:
xiaolongzuo 2019-01-22 16:49:12 +08:00
parent 2de5362f4d
commit 65397e861c
7 changed files with 32 additions and 16 deletions

View File

@ -51,6 +51,7 @@ public class AcmEndpointAutoConfiguration {
} }
@Bean @Bean
@ConditionalOnMissingBean
public AcmHealthIndicator acmHealthIndicator(AcmProperties acmProperties, public AcmHealthIndicator acmHealthIndicator(AcmProperties acmProperties,
AcmPropertySourceRepository acmPropertySourceRepository) { AcmPropertySourceRepository acmPropertySourceRepository) {
return new AcmHealthIndicator(acmProperties, acmPropertySourceRepository); return new AcmHealthIndicator(acmProperties, acmPropertySourceRepository);

View File

@ -27,12 +27,13 @@ public class NacosParameterInitListener
EdasChangeOrderConfiguration edasChangeOrderConfiguration = EdasChangeOrderConfigurationFactory EdasChangeOrderConfiguration edasChangeOrderConfiguration = EdasChangeOrderConfigurationFactory
.getEdasChangeOrderConfiguration(); .getEdasChangeOrderConfiguration();
log.info("Initialize Nacos Parameter from edas change order,is edas managed {}.",
edasChangeOrderConfiguration.isEdasManaged());
if (!edasChangeOrderConfiguration.isEdasManaged()) { if (!edasChangeOrderConfiguration.isEdasManaged()) {
return; return;
} }
log.info("Initialize Nacos Parameter from edas change order,is edas managed {}.",
edasChangeOrderConfiguration.isEdasManaged());
// initialize nacos configuration // initialize nacos configuration
System.getProperties().setProperty("spring.cloud.nacos.config.server-addr", ""); System.getProperties().setProperty("spring.cloud.nacos.config.server-addr", "");
System.getProperties().setProperty("spring.cloud.nacos.config.endpoint", System.getProperties().setProperty("spring.cloud.nacos.config.endpoint",

View File

@ -26,22 +26,23 @@ import org.springframework.context.event.ContextClosedEvent;
import com.aliyun.oss.OSS; import com.aliyun.oss.OSS;
/** /**
* Shutdown All OSS Clients when {@code ApplicationContext} gets closed {@link ApplicationListener} * Shutdown All OSS Clients when {@code ApplicationContext} gets closed
* {@link ApplicationListener}
* *
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a> * @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
*/ */
public class OssApplicationListener implements ApplicationListener<ContextClosedEvent> { public class OssApplicationListener implements ApplicationListener<ContextClosedEvent> {
private static final Logger logger = LoggerFactory private static final Logger log = LoggerFactory
.getLogger(OssApplicationListener.class); .getLogger(OssApplicationListener.class);
@Override @Override
public void onApplicationEvent(ContextClosedEvent event) { public void onApplicationEvent(ContextClosedEvent event) {
Map<String, OSS> ossClientMap = event.getApplicationContext() Map<String, OSS> ossClientMap = event.getApplicationContext()
.getBeansOfType(OSS.class); .getBeansOfType(OSS.class);
logger.info("{} OSSClients will be shutdown soon", ossClientMap.size()); log.info("{} OSSClients will be shutdown soon", ossClientMap.size());
ossClientMap.keySet().forEach(beanName -> { ossClientMap.keySet().forEach(beanName -> {
logger.info("shutdown ossClient: {}", beanName); log.info("shutdown ossClient: {}", beanName);
ossClientMap.get(beanName).shutdown(); ossClientMap.get(beanName).shutdown();
}); });
} }

View File

@ -34,7 +34,7 @@ public class OssEndpointAutoConfiguration {
@Bean @Bean
@ConditionalOnMissingBean @ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint @ConditionalOnEnabledEndpoint
public OssEndpoint sentinelEndPoint() { public OssEndpoint ossEndpoint() {
return new OssEndpoint(); return new OssEndpoint();
} }

View File

@ -39,7 +39,7 @@ public class OssStorageProtocolResolver
public static final String PROTOCOL = "oss://"; public static final String PROTOCOL = "oss://";
private static final Logger logger = LoggerFactory private static final Logger log = LoggerFactory
.getLogger(OssStorageProtocolResolver.class); .getLogger(OssStorageProtocolResolver.class);
private ConfigurableListableBeanFactory beanFactory; private ConfigurableListableBeanFactory beanFactory;
@ -49,8 +49,9 @@ public class OssStorageProtocolResolver
private OSS getOSS() { private OSS getOSS() {
if (this.oss == null) { if (this.oss == null) {
if (this.beanFactory.getBeansOfType(OSS.class).size() > 1) { if (this.beanFactory.getBeansOfType(OSS.class).size() > 1) {
logger.warn( log.warn(
"There are multiple OSS instances, consider marking one of them as @Primary to resolve oss protocol."); "There are multiple OSS instances, consider marking one of them as @Primary to resolve oss "
+ "protocol.");
} }
this.oss = this.beanFactory.getBean(OSS.class); this.oss = this.beanFactory.getBean(OSS.class);
} }
@ -71,7 +72,7 @@ public class OssStorageProtocolResolver
((DefaultResourceLoader) resourceLoader).addProtocolResolver(this); ((DefaultResourceLoader) resourceLoader).addProtocolResolver(this);
} }
else { else {
logger.warn("The provided delegate resource loader is not an implementation " log.warn("The provided delegate resource loader is not an implementation "
+ "of DefaultResourceLoader. Custom Protocol using oss:// prefix will not be enabled."); + "of DefaultResourceLoader. Custom Protocol using oss:// prefix will not be enabled.");
} }
} }

View File

@ -38,6 +38,12 @@
<scope>provided</scope> <scope>provided</scope>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId> <artifactId>spring-boot-actuator</artifactId>

View File

@ -16,8 +16,10 @@
package org.springframework.cloud.alicloud.scx.endpoint; package org.springframework.cloud.alicloud.scx.endpoint;
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.cloud.alicloud.context.edas.EdasProperties; import org.springframework.cloud.alicloud.context.edas.EdasProperties;
import org.springframework.cloud.alicloud.context.scx.ScxProperties; import org.springframework.cloud.alicloud.context.scx.ScxProperties;
@ -31,7 +33,11 @@ import org.springframework.context.annotation.Bean;
public class ScxEndpointAutoConfiguration { public class ScxEndpointAutoConfiguration {
@Bean @Bean
public ScxEndpoint scxEndpoint(EdasProperties edasProperties, ScxProperties scxProperties) { @ConditionalOnMissingBean
@ConditionalOnEnabledEndpoint
public ScxEndpoint scxEndpoint(EdasProperties edasProperties,
ScxProperties scxProperties) {
return new ScxEndpoint(edasProperties, scxProperties); return new ScxEndpoint(edasProperties, scxProperties);
} }
} }