У меня есть проект с микро-сервисами gateway-server (Zuul), eureka-server с интеграцией сервера конфигурации.
У меня есть git-репозиторий, в котором есть файл свойств gateway-server (gateway-server-dev.yml)
файл gateway-server-dev.yml:
spring:
application:
name: gateway-server
info:
component: Gateway Server
endpoints:
restart:
enabled: true
shutdown:
enabled: true
health:
sensitive: false
zuul:
prefix: /CustomerHub/api
routes:
create-customer:
path: /create/**
serviceId: create-customer
search-customer:
path: /search/**
serviceId: search-customer
update:
path: /update/**
serviceId: update-customer
authorization:
path: /authorization/**
sensitiveHeaders:
serviceId: customerhub-authorization
host:
connect-timeout-millis: 5000
socket-timeout-millis: 10000
max-total-connections: 10000
max-per-route-connections: 50
ribbon:
eager-load:
enabled: true
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
MaxAutoRetries: 3
MaxAutoRetriesNextServer: 3
restclient:
enabled: true
eureka:
enabled: true
eureka:
client:
serviceUrl:
defaultZone: http://{host}:{port}/eureka
registerWithEureka: true
instance:
preferIpAddress: true
hystrix:
threadpool:
default:
coreSize: 1000
maximumSize: 10000
queueSizeRejectionThreshold: -1
maxQueueSize: -1
command:
default:
execution:
isolation:
strategy: THREAD
thread:
timeoutInMilliseconds: 60000
server:
port: 9000
logging:
file: /app/logs/aaa_gateway.log
level:
org.springframework.web: INFO
com.customerhub.filters: INFO
org.hibernate: INFO
customerhub:
authorization:
check-token-url: /oauth/check_token
И файл начальной загрузки в gateway-server:
spring.profiles.active=dev
spring.application.name=gateway-server
spring.cloud.config.uri=http://{host}:{port}
management.security.enabled=false
management.endpoints.web.exposure.include=*
Теперь, когда я выполняю в eclipse в моей локальной системе, он работает нормально и получает свойства с сервера конфигурации.
Когда я запускаю тот же самый jar через командную строку, он выдает следующую ошибку:
Не удалось разрешить заполнитель 'zuul.prefix' в значении "$ {zuul.prefix}"
Файл журнала:
2018-11-16 15:08:01.523 INFO 8604 --- [ost-startStop-1]
c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic
configuration sources, define System property
archaius.configurationSource.additionalUrls or make config.properties
available on classpath.
2018-11-16 15:08:01.555 INFO 8604 --- [ost-startStop-1]
c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is
initialized with configuration sources:
com.netflix.config.ConcurrentCompositeConfiguration@ef4443e
2018-11-16 15:08:01.977 ERROR 8604 --- [ost-startStop-1]
o.s.b.c.embedded.tomcat.TomcatStarter : Error starting Tomcat context.
Exception: org.springframework.beans.factory.UnsatisfiedDependencyException.
Message: Error creating bean with name'org.springframework.cloud.netflix.zuul.ZuulConfiguration$ZuulFilterConfigur
ation': Unsatisfied dependency expressed through field 'filters'; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'preFilter': Injection of autowired dependencies
failed; nested exception is java.lang.IllegalArgumentException: Could not
resolve placeholder 'zuul.prefix' in value "${zuul.prefix}"