У меня есть доступ для проектов микросервисов к общему серверу конфигурации. Однако конфигурация для клиента Eugene работает, но для apache Kafka не работает.
Spring Config server
@SpringBootApplication
@EnableEurekaClient
@EnableConfigServer
public class FeteBirdConfigurationServerApplication {
public static void main(String[] args) {
SpringApplication.run(FeteBirdConfigurationServerApplication.class, args);
}
}
bootstrap .yml
spring:
cloud:
config:
server:
git:
uri: https://github.com/anandjaisy/Microservice-Cloud-Config
Сервер конфигурации
spring:
application:
name: CONFIG-SERVER
server:
port: 8085
Git Репо
eureka:
client:
register-with-eureka: true
fetch-registry: true
service-url:
defaultZone: http://localhost:8761/eureka/
instance:
hostname: localhost
spring:
kafka:
producer:
value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
Micoservice обращается к серверу конфигурации
bootstrap .yml
spring:
cloud:
config:
uri:
- http://localhost:8085
Если я помещаю конфигурацию Kafka в файл microservice application.yml, конфигурация работает, но если я удалю и попытаюсь получить доступ к конфигурации сервер не работает. spring: application: name: ORDER-SERVICE kafka: продюсер: value-serializer: org.springframework.kafka.support.serializer.JsonSerializer
Журналы из микросервиса
2020-07-13 15:11:08.441 INFO 2025 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8085
2020-07-13 15:11:08.992 INFO 2025 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://localhost:8085. Will be trying the next url if available
2020-07-13 15:11:08.999 WARN 2025 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8085/ORDER-SERVICE/dev": Connection refused; nested exception is java.net.ConnectException: Connection refused
2020-07-13 15:11:09.004 INFO 2025 --- [ restartedMain] f.b.f.FeteBirdOrderApplication : The following profiles are active: dev
2020-07-13 15:11:17.529 WARN 2025 --- [ restartedMain] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2020-07-13 15:11:18.328 INFO 2025 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=0bb24ffe-2fc1-3960-867f-4b6e7735d255
2020-07-13 15:11:20.952 INFO 2025 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http)
2020-07-13 15:11:21.095 INFO 2025 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-07-13 15:11:21.096 INFO 2025 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.36]
2020-07-13 15:11:21.612 INFO 2025 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-07-13 15:11:21.613 INFO 2025 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 12525 ms
2020-07-13 15:11:22.495 WARN 2025 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-07-13 15:11:22.495 INFO 2025 --- [ restartedMain] 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.
2020-07-13 15:11:22.541 INFO 2025 --- [ restartedMain] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@59982a7
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils (file:/Users/macbook/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/5.2.7.RELEASE/56e14a3a5e2813534b5db2da1502cd58ab5bc61d/spring-core-5.2.7.RELEASE.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2020-07-13 15:11:31.448 INFO 2025 --- [ restartedMain] o.s.b.a.e.web.EndpointLinksResolver : Exposing 17 endpoint(s) beneath base path '/actuator'
2020-07-13 15:11:32.508 WARN 2025 --- [ restartedMain] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2020-07-13 15:11:32.508 INFO 2025 --- [ restartedMain] 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.
2020-07-13 15:11:32.931 INFO 2025 --- [ restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-07-13 15:11:33.094 WARN 2025 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : Unable to start LiveReload server
2020-07-13 15:11:34.161 WARN 2025 --- [ restartedMain] ockingLoadBalancerClientRibbonWarnLogger : You already have RibbonLoadBalancerClient on your classpath. It will be used by default. As Spring Cloud Ribbon is in maintenance mode. We recommend switching to BlockingLoadBalancerClient instead. In order to use it, set the value of `spring.cloud.loadbalancer.ribbon.enabled` to `false` or remove spring-cloud-starter-netflix-ribbon from your project.