Spring Boot config Client |休息终点无效

时间:2017-11-16 17:46:46

标签: spring spring-boot spring-config

我试图通过spring boot配置服务器外部化配置。

我使用SVN作为配置的版本控制。

https://svnret2.uk.fid-intl.com:18081/svn/Test_Config/trunk/dev/myapp/myapp-dev.properties

配置服务器正在运行端口8888。 ----------application.properties for config server ----------

server.port = 8888
management.security.enabled=false  
endpoints.health.sensitive: false       
spring.profiles.include: subversion  
spring.cloud.config.server.bootstrap: true  
spring.cloud.config.server.svn.uri: https://svnret2.uk.fid-intl.com:18081/svn/Test_Config/  
spring.cloud.config.server.svn.label: trunk  
spring.cloud.config.server.svn.searchPaths: dev/myapp  
spring.cloud.config.server.svn.username: *****  
spring.cloud.config.server.svn.password: *****  

为了使用配置服务器中的属性,我在application.properties中创建了具有以下配置的spring config客户端

---------- --------- application.properties

server.port = 8081 
management.security.enabled=false  
spring.cloud.config.uri=http://localhost:8888  

在配置客户端中有一个休息终点,如下所示:
----------休息终点----------

@RestController
public class MessageController {

    @Value("${TestMessage}")
    private String message;

    @RequestMapping("/message")
    public String getMessage() {
        System.out.println("Message :" + message);
        return message;
    }
}

-----------------------------执行步骤---------------- ----
以 - >运行运行配置
参数
   -Dspring.application.name = MyApp的
   -Dspring.profiles.active = dev

客户端已启动并在端口8081上运行。但我在访问http://localhost:8081/message

时收到404

0 个答案:

没有答案