Polish , fixes
@@ -41,13 +41,13 @@ import org.springframework.context.annotation.Configuration;
@EnableConfigurationProperties
@ConditionalOnNacosDiscoveryEnabled
@ConditionalOnProperty(value = "spring.cloud.service-registry.auto-registration.enabled", matchIfMissing = true)
-@AutoConfigureBefore({AutoServiceRegistrationAutoConfiguration.class,
- NacosDiscoveryClientAutoConfiguration.class})
-@AutoConfigureAfter(AutoServiceRegistrationConfiguration.class)
+@AutoConfigureBefore(NacosDiscoveryClientAutoConfiguration.class)
+@AutoConfigureAfter(AutoServiceRegistrationAutoConfiguration.class)
public class NacosDiscoveryAutoConfiguration {
@Bean
- public NacosServiceRegistry nacosServiceRegistry(NacosDiscoveryProperties nacosDiscoveryProperties) {
+ public NacosServiceRegistry nacosServiceRegistry(
+ NacosDiscoveryProperties nacosDiscoveryProperties) {
return new NacosServiceRegistry(nacosDiscoveryProperties);
}
@@ -70,17 +70,22 @@ public class NacosDiscoveryAutoConfiguration {
}
@Bean
- @ConditionalOnBean(NacosAutoServiceRegistration.class) // NacosAutoServiceRegistration should be present
+ @ConditionalOnBean(NacosAutoServiceRegistration.class) // NacosAutoServiceRegistration
+ // should be present
@ConditionalOnNotWebApplication // Not Web Application
- public ApplicationRunner applicationRunner(NacosAutoServiceRegistration nacosAutoServiceRegistration) {
+ public ApplicationRunner applicationRunner(
+ NacosAutoServiceRegistration nacosAutoServiceRegistration) {
return args -> {
// WebServerInitializedEvent should not be multicast in Non-Web environment.
// Whatever, NacosAutoServiceRegistration must be checked it's running or not.
- if (!nacosAutoServiceRegistration.isRunning()) { // If it's not running, let it start.
- // FIXME: Please make sure "spring.cloud.nacos.discovery.port" must be configured on an available port,
+ if (!nacosAutoServiceRegistration.isRunning()) { // If it's not running, let
+ // it start.
+ // FIXME: Please make sure "spring.cloud.nacos.discovery.port" must be
+ // configured on an available port,
// or the startup or Nacos health check will be failed.
nacosAutoServiceRegistration.start();
- // NacosAutoServiceRegistration will be stopped after its destroy() method is invoked.
+ // NacosAutoServiceRegistration will be stopped after its destroy() method
+ // is invoked.
// @PreDestroy destroy() -> stop()
}
};
