Updates to compile with Finchley and Boot 2.0
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
To install, make
|
||||
sure you have
|
||||
https://github.com/spring-projects/spring-boot[Spring Boot CLI]
|
||||
(1.5.2 or better):
|
||||
(2.0.0 or better):
|
||||
|
||||
$ spring version
|
||||
Spring CLI v1.5.8.RELEASE
|
||||
Spring CLI v2.0.0.M6
|
||||
|
||||
E.g. for SDKMan users
|
||||
|
||||
```
|
||||
$ sdk install springboot 1.5.8.RELEASE
|
||||
$ sdk use springboot 1.5.8.RELEASE
|
||||
$ sdk install springboot 2.0.0.M6
|
||||
$ sdk use springboot 2.0.0.M6
|
||||
```
|
||||
|
||||
and install the Spring Cloud plugin
|
||||
|
||||
```
|
||||
$ mvn install
|
||||
$ spring install org.springframework.cloud:spring-cloud-cli:1.4.1.BUILD-SNAPSHOT
|
||||
$ spring install org.springframework.cloud:spring-cloud-cli:2.0.0.BUILD-SNAPSHOT
|
||||
```
|
||||
|
||||
IMPORTANT: **Prerequisites:** to use the encryption and decryption features
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -24,7 +24,7 @@
|
||||
<bintray.package>cli</bintray.package>
|
||||
<docs.main>spring-cloud-cli</docs.main>
|
||||
<main.basedir>${basedir}/..</main.basedir>
|
||||
<spring-boot.version>2.0.0.M6</spring-boot.version>
|
||||
<spring-boot.version>2.0.0.BUILD-SNAPSHOT</spring-boot.version>
|
||||
<spring-cloud.version>Finchley.BUILD-SNAPSHOT</spring-cloud.version>
|
||||
</properties>
|
||||
<modules>
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.springframework.boot.cli.command.OptionParsingCommand;
|
||||
import org.springframework.boot.cli.command.archive.JarCommand;
|
||||
import org.springframework.boot.cli.command.grab.GrabCommand;
|
||||
import org.springframework.boot.cli.command.run.RunCommand;
|
||||
import org.springframework.boot.cli.command.test.TestCommand;
|
||||
import org.springframework.util.SocketUtils;
|
||||
|
||||
/**
|
||||
@@ -75,17 +74,6 @@ public class CliTester implements TestRule {
|
||||
return getOutput();
|
||||
}
|
||||
|
||||
public String test(String... args) throws Exception {
|
||||
Future<TestCommand> future = submitCommand(new TestCommand(), args);
|
||||
try {
|
||||
this.commands.add(future.get(this.timeout, TimeUnit.MILLISECONDS));
|
||||
return getOutput();
|
||||
}
|
||||
catch (Exception ex) {
|
||||
return getOutput();
|
||||
}
|
||||
}
|
||||
|
||||
public String grab(String... args) throws Exception {
|
||||
Future<GrabCommand> future = submitCommand(new GrabCommand(), args);
|
||||
this.commands.add(future.get(this.timeout, TimeUnit.MILLISECONDS));
|
||||
|
||||
@@ -37,7 +37,7 @@ public class EurekaClientCompilerAutoConfiguration extends CompilerAutoConfigura
|
||||
public void applyDependencies(DependencyCustomizer dependencies) {
|
||||
dependencies.ifAnyMissingClasses(
|
||||
"org.springframework.cloud.client.discovery.EnableDiscoveryClient").add(
|
||||
"spring-cloud-starter-eureka");
|
||||
"spring-cloud-starter-netflix-eureka-client");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class EurekaServerCompilerAutoConfiguration extends CompilerAutoConfigura
|
||||
public void applyDependencies(DependencyCustomizer dependencies) {
|
||||
dependencies.ifAnyMissingClasses(
|
||||
"org.springframework.cloud.netflix.eureka.server.EnableEurekaServer")
|
||||
.add("spring-cloud-starter-eureka-server");
|
||||
.add("spring-cloud-starter-netflix-eureka-server");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class HystrixCompilerAutoConfiguration extends CompilerAutoConfiguration
|
||||
public void applyDependencies(DependencyCustomizer dependencies) {
|
||||
dependencies.ifAnyMissingClasses(
|
||||
"org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker")
|
||||
.add("spring-cloud-starter-hystrix");
|
||||
.add("spring-cloud-starter-netflix-hystrix");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class HystrixDashboardCompilerAutoConfiguration extends CompilerAutoConfi
|
||||
public void applyDependencies(DependencyCustomizer dependencies) {
|
||||
dependencies.ifAnyMissingClasses(
|
||||
"org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard")
|
||||
.add("spring-cloud-starter-hystrix-dashboard");
|
||||
.add("spring-cloud-starter-netflix-hystrix-dashboard");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ZuulCompilerAutoConfiguration extends CompilerAutoConfiguration {
|
||||
public void applyDependencies(DependencyCustomizer dependencies) {
|
||||
dependencies
|
||||
.ifAnyMissingClasses("org.springframework.cloud.netflix.zuul.EnableZuulProxy")
|
||||
.add("spring-cloud-starter-zuul");
|
||||
.add("spring-cloud-starter-netflix-zuul");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
@@ -35,7 +35,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
|
||||
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.I0Itec.zkclient.ZkClient;
|
||||
import org.I0Itec.zkclient.exception.ZkInterruptedException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.kafka.common.protocol.SecurityProtocol;
|
||||
import org.apache.kafka.common.utils.Time;
|
||||
import org.apache.kafka.common.utils.Utils;
|
||||
import org.apache.zookeeper.server.NIOServerCnxnFactory;
|
||||
import org.apache.zookeeper.server.ZooKeeperServer;
|
||||
@@ -41,12 +41,13 @@ import kafka.server.KafkaConfig;
|
||||
import kafka.server.KafkaServer;
|
||||
import kafka.server.NotRunning;
|
||||
import kafka.utils.CoreUtils;
|
||||
import kafka.utils.SystemTime$;
|
||||
import kafka.utils.TestUtils;
|
||||
import kafka.utils.ZKStringSerializer$;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*
|
||||
* see https://github.com/spring-projects/spring-kafka/blob/2.0.x/spring-kafka-test/src/main/java/org/springframework/kafka/test/rule/KafkaEmbedded.java
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class KafkaApplication {
|
||||
@@ -108,10 +109,10 @@ public class KafkaApplication {
|
||||
boolean enableControlledShutdown = true;
|
||||
Properties brokerConfigProperties = TestUtils.createBrokerConfig(
|
||||
nodeId, zkConnectString, enableControlledShutdown, true,
|
||||
port, scala.Option.<SecurityProtocol>apply(null),
|
||||
scala.Option.<File>apply(null),
|
||||
scala.Option.<Properties>apply(null), true, false, 0,
|
||||
false, 0, false, 0, scala.Option.<String>apply(null));
|
||||
port, scala.Option.apply(null),
|
||||
scala.Option.apply(null),
|
||||
scala.Option.apply(null), true, false, 0,
|
||||
false, 0, false, 0, scala.Option.apply(null), 1);
|
||||
brokerConfigProperties.setProperty("replica.socket.timeout.ms",
|
||||
"1000");
|
||||
brokerConfigProperties.setProperty("controller.socket.timeout.ms",
|
||||
@@ -121,7 +122,7 @@ public class KafkaApplication {
|
||||
brokerConfigProperties.put("zookeeper.connect", zkConnectString);
|
||||
kafkaServer = TestUtils.createServer(
|
||||
new KafkaConfig(brokerConfigProperties),
|
||||
SystemTime$.MODULE$);
|
||||
Time.SYSTEM);
|
||||
log.info("Created Kafka server at "
|
||||
+ kafkaServer.config().hostName() + ":"
|
||||
+ kafkaServer.config().port());
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-launcher</artifactId>
|
||||
<version>1.4.1.BUILD-SNAPSHOT</version>
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-eureka</artifactId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.zipkin.java</groupId>
|
||||
|
||||
@@ -16,20 +16,81 @@
|
||||
|
||||
package org.springframework.cloud.launcher.zipkin;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
import zipkin.server.EnableZipkinServer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
import zipkin.collector.CollectorMetrics;
|
||||
import zipkin.collector.CollectorSampler;
|
||||
import zipkin.internal.V2StorageComponent;
|
||||
import zipkin.server.ZipkinHttpCollector;
|
||||
import zipkin.server.ZipkinQueryApiV1;
|
||||
import zipkin.server.brave.BraveConfiguration;
|
||||
import zipkin.storage.StorageComponent;
|
||||
import zipkin2.storage.InMemoryStorage;
|
||||
|
||||
/**
|
||||
* @author Spencer Gibb
|
||||
*/
|
||||
@EnableZipkinServer
|
||||
// @EnableZipkinServer
|
||||
@Import({/*ZipkinServerConfiguration.class,*/ BraveConfiguration.class, ZipkinQueryApiV1.class, ZipkinHttpCollector.class})
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class ZipkinServerApplication {
|
||||
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({CollectorSampler.class})
|
||||
CollectorSampler traceIdSampler(@Value("${zipkin.collector.sample-rate:1.0}") float rate) {
|
||||
return CollectorSampler.create(rate);
|
||||
}
|
||||
|
||||
@Bean
|
||||
CollectorMetrics metrics() {
|
||||
return CollectorMetrics.NOOP_METRICS;
|
||||
}
|
||||
|
||||
static final class StorageTypeMemAbsentOrEmpty implements Condition {
|
||||
StorageTypeMemAbsentOrEmpty() {
|
||||
}
|
||||
|
||||
public boolean matches(ConditionContext condition, AnnotatedTypeMetadata ignored) {
|
||||
String storageType = condition.getEnvironment().getProperty("zipkin.storage.type");
|
||||
if (storageType == null) {
|
||||
return true;
|
||||
} else {
|
||||
storageType = storageType.trim();
|
||||
return storageType.isEmpty() ? true : storageType.equals("mem");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Conditional({ZipkinServerApplication.StorageTypeMemAbsentOrEmpty.class})
|
||||
@ConditionalOnMissingBean({StorageComponent.class})
|
||||
static class InMemoryConfiguration {
|
||||
InMemoryConfiguration() {
|
||||
}
|
||||
|
||||
@Bean
|
||||
StorageComponent storage(@Value("${zipkin.storage.strict-trace-id:true}") boolean strictTraceId, @Value("${zipkin.storage.mem.max-spans:500000}") int maxSpans) {
|
||||
return V2StorageComponent.create(InMemoryStorage.newBuilder().strictTraceId(strictTraceId).maxSpanCount(maxSpans).build());
|
||||
}
|
||||
|
||||
@Bean
|
||||
InMemoryStorage v2Storage(V2StorageComponent component) {
|
||||
return (InMemoryStorage)component.delegate();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ZipkinServerApplication.class, args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user