Dav*_*ujo 6 spring spring-boot spring-cloud spring-cloud-config
我正在尝试使用后端存储库(文件系统)设置 Spring Cloud Config Server,但端点(http://localhost:8888/licensingservice/default)返回以下内容:
{"name":"licensingservice","profiles":["default"],"label":null,"version":null,"state":null,"propertySources":[]}
Run Code Online (Sandbox Code Playgroud)
主要的:
@EnableConfigServer
@SpringBootApplication
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud)
应用程序.yml:
server:
port: 8888
spring:
profiles:
active: native
cloud:
config:
server:
native:
searchLocations: file:///Users/josedavi/Desenvolvimento/WorkSpace/Pessoal/sample-spring-microservices/sample-spring-microservices/config-server/src/main/resources/config
Run Code Online (Sandbox Code Playgroud)
许可服务.yml:
tracer.property: "I AM THE DEFAULT"
spring.jpa.database: "POSTGRESQL"
spring.datasource.platform: "postgres"
spring.jpa.show-sql: "true"
spring.database.driverClassName: "org.postgresql.Driver"
spring.datasource.url: "jdbc:postgresql://database:5432/eagle_eye_local"
spring.datasource.username: "postgres"
spring.datasource.password: "p0stgr@s"
spring.datasource.testWhileIdle: "true"
spring.datasource.validationQuery: "SELECT 1"
spring.jpa.properties.hibernate.dialect: "org.hibernate.dialect.PostgreSQLDialect"
Run Code Online (Sandbox Code Playgroud)
服务配置的路径:
C:\Users\josedavi\Desenvolvimento\WorkSpace\Pessoal\sample-spring-microservices\sample-spring-microservices\config-server\src\main\resources\config
Run Code Online (Sandbox Code Playgroud)
项目: https: //github.com/jdavid-araujo/sample-spring-microservices
application.yml在您的配置服务中添加以下格式:
[类路径:/,类路径:/config,类路径:/config/{应用程序},类路径:/config/{应用程序}/{配置文件}]
上述格式分别从config文件夹、下一个文件夹的application名称、application名称和位置搜索位置profile。
spring:
profiles:
active: native
cloud:
config:
server:
native:
searchLocations: "[classpath:/, classpath:/config, classpath:/config/{application}, classpath:/config/{application}/{profile}]"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22045 次 |
| 最近记录: |