support for @EnableZuulProxy

This commit is contained in:
Spencer Gibb
2014-08-06 01:52:46 -06:00
parent 2a39eaf322
commit ace5f21c58
3 changed files with 55 additions and 1 deletions

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2013-2014 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.springframework.platform.cli.compiler;
import org.codehaus.groovy.ast.ClassNode;
import org.codehaus.groovy.control.CompilationFailedException;
import org.codehaus.groovy.control.customizers.ImportCustomizer;
import org.springframework.boot.cli.compiler.AstUtils;
import org.springframework.boot.cli.compiler.CompilerAutoConfiguration;
import org.springframework.boot.cli.compiler.DependencyCustomizer;
/**
* @author Dave Syer
*
*/
public class ZuulCompilerAutoConfiguration extends CompilerAutoConfiguration {
@Override
public boolean matches(ClassNode classNode) {
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableZuulProxy");
}
@Override
public void applyDependencies(DependencyCustomizer dependencies) {
dependencies
.ifAnyMissingClasses("org.springframework.platform.netflix.zuul.EnableZuulProxy")
.add("spring-platform-starter-zuul");
}
@Override
public void applyImports(ImportCustomizer imports) throws CompilationFailedException {
imports.addImports("org.springframework.platform.netflix.zuul.EnableZuulProxy");
}
}

View File

@@ -1,4 +1,5 @@
org.springframework.platform.cli.compiler.SpringPlatformCompilerAutoConfiguration
org.springframework.platform.cli.compiler.ConfigServerCompilerAutoConfiguration
org.springframework.platform.cli.compiler.EurekaClientCompilerAutoConfiguration
org.springframework.platform.cli.compiler.HystrixCompilerAutoConfiguration
org.springframework.platform.cli.compiler.HystrixCompilerAutoConfiguration
org.springframework.platform.cli.compiler.ZuulCompilerAutoConfiguration

View File

@@ -35,6 +35,11 @@
<artifactId>spring-platform-starter-hystrix</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.platform</groupId>
<artifactId>spring-platform-starter-zuul</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>