2017-04-12 17 views
0

私は1.3.0.releaseバージョンのため、春の雲の設定をしようとしています、私は春の設定エラーが上/ envを

下記のpom.xmlでシンプルなクライアントを構築しようとした

curl localhost:8888/foo/development returns 

{"name":"foo","profiles":["development"],"label":null,"version":null,"state":null,"propertySources":[{"name":"https://github.com/spring-cloud-samples/config-repo/foo-development.properties","source":{"bar":"spam","foo":"from foo development"}},{"name":"https://github.com/spring-cloud-samples/config-repo/foo.properties","source":{"democonfigclient.message":"hello spring io","foo":"from foo props"}},{"name":"https://github.com/spring-cloud-samples/config-repo/application.yml","source":{"info.description":"Spring Cloud Samples","info.url":"https://github.com/spring-cloud-samples","eureka.client.serviceUrl.defaultZone":"http://localhost:8761/eureka/","foo":"baz"}}]} 

成功してサーバーを開始しました

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>org.springframework</groupId> 
    <artifactId>gs-spring-config</artifactId> 
    <version>0.1.0</version> 

    <parent> 
     <groupId>org.springframework.cloud</groupId> 
     <artifactId>spring-cloud-starter-parent</artifactId> 
     <version>Brixton.RELEASE</version> 
    </parent> 

    <dependencies> 
     <dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-starter-config</artifactId> 
     </dependency> 
     <!-- tag::tests[] --> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-test</artifactId> 
      <scope>test</scope> 
     </dependency> 
     <!-- end::tests[] --> 
    </dependencies> 

    <properties> 
     <java.version>1.8</java.version> 
    </properties> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
      </plugin> 
      <plugin> 
       <artifactId>maven-failsafe-plugin</artifactId> 
       <executions> 
        <execution> 
         <goals> 
          <goal>integration-test</goal> 
          <goal>verify</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 

</project> 

は、それから私は、MVN春ブートを使用します。実行し、それは常に

を停止し、私は、依存関係に追加する場合

org.springframework.boot 春ブート・スターター・ウェブ

それが起動することができますが、私はlocalhostを訪問したとき:8080/ENVを、それは常にここに何が不足しているか、404を返しますか?

Hello.java 

    package hello; 

    import org.springframework.web.bind.annotation.RestController; 
    import org.springframework.web.bind.annotation.RequestMapping; 

    @RestController 
    public class HelloController { 

     @RequestMapping("/") 
     public String index() { 
      return "Hello World"; 
     } 

    } 
+0

は、依存関係として 'ばねブートスタータactuator'が挙げられます。 –

+0

ログにエラーメッセージがありますか? – reos

答えて

1

コメントで述べたように、含まれる:

<dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-actuator</artifactId> 
    </dependency> 
関連する問題