Spring Cloud Configuration Server not working with local properties file

后端 未结 9 2173
渐次进展
渐次进展 2020-12-05 07:43

I have been playing around with the Spring Cloud project on github located here: https://github.com/spring-cloud/spring-cloud-config

However I have been running into

9条回答
  •  时光取名叫无心
    2020-12-05 08:36

    Here is what I did:

    following https://medium.com/@danismaz.furkan/spring-cloud-config-with-file-system-backend-c18ae16b7ad5

    1) !!dont forget your VM options!!:

    -Dspring.profiles.active=native
    

    (in Netbeans : configserver->project->properties>Run->VM options

    2) Either in application.properties

    #spring.cloud.config.server.native.searchLocations=file:///C:/tmp/config
    
    spring.cloud.config.server.native.searchLocations=classpath:/config
    

    or applications.yml

    spring:
    
        cloud:
    
             config:
    
                server:
    
                    native:
    
                        search-locations  : file:///C:/tmp/config
                        #search-locations : classpath:/config
    

    Notes:

    n1: search-locations and searchLocations both work

    n2: file:/// => hard file path

    Like

    c:/temp/config/
               app-admin.yml
               app-admin-develop.yml
               .... 
    

    n3: for your profile config files

    classpath:/

    Like

    Other sources/src/main/resources/config/app-admin.yml
    

    n4: I couldnt made file paths work without setting the vm options. Dont forget! Just setting spring.profiles.active=native in your application config does not do the trick for me

    n5: example http queries

    http://localhost:8998/app-admin/default/yml

    gives app-admin.yml

    http://localhost:8998/app-admin/develop/yml

    gives app-admin-develop.yml

提交回复
热议问题