我正在尝试使用 BitBucket 私有存储库设置 Spring Cloud 的配置服务器,但没有任何运气。无论我使用什么配置,在尝试加载配置时似乎总是返回 404。
我也尝试过在 中设置断点JGitEnvironmentRepository,但似乎从未在afterPropertiesSet. 如果我在调试时手动触发findOne(application,profile,label),则会收到错误消息Branch name <null> not allowed。如果我为属性指定“master” label,那么我会收到可怕的Ref master cannot be resolved错误。
该应用程序加载正常,但没有结果。从我读过的所有文档来看,这似乎应该是开箱即用的。任何帮助,将不胜感激。
bootstrap.yml
server:
port: 8888
spring:
application:
name: config-service
cloud:
bus.amqp.enabled: false
config:
enabled: false
failFast: true
server:
prefix: /configs
git :
uri: https://bitbucket.org/[team]/[repo].git
username: [user]
password: [pass]
Run Code Online (Sandbox Code Playgroud)
回购文件
- demo.app.yml
Run Code Online (Sandbox Code Playgroud)
尝试的网址
我使用 Spring Boot 开发了一个微服务。该服务使用 Spring 云配置服务器获取属性。该微服务接受标头中的版本,并根据版本执行适当的功能。在我的 github 存储库中,我有 2 个分支,每个版本 1 个。该服务通常将以下信息发送到配置服务器以获取属性 -
应用程序名称+配置文件+标签
有没有办法在我的 .yml 文件中用占位符代替标签?如果我在标题中看到 v1,则我希望将标签动态设置为 v1,否则 v2。
编辑:
我在本文档( http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html )的“Git URI 中的占位符”部分下看到对占位符的引用,但是我不确定值如何从传入请求动态替换
spring cloud-foundry spring-boot spring-cloud spring-cloud-config
我们正在尝试在涡轮流中启用 https。我们面临以下问题:
\n\nERROR 10644 --- [o-eventloop-3-1] r.n.p.h.s.ServerRequestResponseConverter : Invalid HTTP request recieved. Decoder error.\n\njava.lang.IllegalArgumentException: invalid version format: \xef\xbf\xad\\\xef\xbf\x87:4\'|"\xef\xbf\x80+\xef\xbf\x80/\xef\xbf\x80,\xef\xbf\x800\xef\xbf\x8c\xef\xbe\xa9\xef\xbf\x8c\xef\xbe\xa8\xef\xbf\x8c\xef\xbf\x8c\xef\xbf\x80 \xef\xbf\x80\xef\xbf\x80\n at io.netty.handler.codec.http.HttpVersion.<init>(HttpVersion.java:130) ~[netty-codec-http-4.0.27.Final.jar!/:4.0.27.Final]\n at io.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:84) ~[netty-codec-http-4.0.27.Final.jar!/:4.0.27.Final]\nRun Code Online (Sandbox Code Playgroud)\n\n请提供任何建议\n谢谢。
\n\n更新\n我们是否需要启用 ssl 来处理流的消息代理
\n\n代码
\n\n@SpringBootApplication\n@RestController\n@EnableDiscoveryClient\n@EnableTurbineStream\npublic class DemoHystrixApplication {\n\n public static void main(String[] args) {\n SpringApplication.run(DemoHystrixApplication.class, args);\n }\n\n @RequestMapping(value ="/test")\n public String helloHystrix() {\n ObjectMapper mapper = new ObjectMapper();\n String output = null;\n try {\n output = mapper.writeValueAsString("{ \\"message\\" : \\"test : Welcome to test Notification Detail Page.\\"}");\n } …Run Code Online (Sandbox Code Playgroud) 我是 spring 新手,正在开发基于云的应用程序,并尝试使用 RabbitTemplate 和 RabbitMQ。
我能够将数据存储到队列中使用。
rabbitTemplate.convertAndSend(QUEUE_NAME, msg);
Run Code Online (Sandbox Code Playgroud)
但是当我使用从同一个队列接收数据时
rabbitTemplate.receiveAndConvert(QUEUE_NAME)
Run Code Online (Sandbox Code Playgroud)
我遇到异常:
错误原因:java.io.IOException 2016-09-13T11:15:21.38 + 0530 [App / 0]错误在com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)2016-09-13T11 :15:21.38 + 0530 [App / 0]在com.rabbitmq.client.impl.AQChannel.wrap(AQChannel.java:102)发生错误2016-09-13T11:15:21.38 + 0530 [App / 0]在com发生错误.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:124) 2016-09-13T11:15:21.38+0530 [App/0] com.rabbitmq.client.impl.ChannelN.basicGet(ChannelN.java) 出现错误:985)2016-09-13T11:15:21.38 + 0530 [App / 0]错误在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)2016-09-13T11:15:21.38 + 0530 [App/0]错误在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 2016-09-13T11:15:21.38+0530 [App/0] Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2016-09-出现错误13T11:15:21.38 + 0530 [App / 0]错误在java.lang.reflect.Method.invoke(Method.java:498)2016-09-13T11:15:21.38 + 0530 [App / 0]错误在组织。 springframework.amqp.rabbit.connection.CachingConnectionFactory$CachedChannelInitationHandler.invoke(CachingConnectionFactory.java:625) 2016-09-13T11:15:21.38+0530 [App/0] com.sun.proxy.$Proxy55.basicGet 出现错误(未知来源)2016-09-13T11:15:21.38 + 0530 [App / 0]错误在org.springframework.amqp.rabbit.core.RabbitTemplate $ 4.doInRabbit(RabbitTemplate.java:650)2016-09-13T11:15:21.38 +0530 [App/0] org.springframework.amqp.rabbit.core.RabbitTemplate$4.doInRabbit(RabbitTemplate.java:646) 2016-09-13T11:15:21.38+0530 [App/0] org. springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1045) 2016-09-13T11:15:21.38+0530 [App/0] ERR ... 50 …
我有一个 Spring boot 应用程序,它使用 logback.xml 进行日志记录配置。我正在寻找动态更改日志级别的选项。例如,如果我部署了一个日志级别为 ERROR 的应用程序,假设我想将其更改为 INFO,但我不想重新部署/重新启动我的 JVM。
我们是否有可能像配置服务器一样配置 logback.xml 来实现这一点
我了解了 spring-boots 配置服务器和配置客户端方法。但每次,当我对属性进行一些更改以反映在客户端时,我都必须调用刷新 POST API,而我想避免这种情况。我们可以在代码内部调用刷新而不是外部调用吗?
请帮忙。
我想在 Spring Cloud 中通过一次调用将多条消息作为批处理发送到 SQS 队列。我在aws java sdk中找到了amazonSqs.sendMessageBatch()方法。spring cloud aws api 中是否有任何替代方法可以批量发送消息。
我正在尝试使用 Spring Framework Cloud 创建一个 Maven 项目。我定义了 pom.xml 文件如下
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Brixton.RELEASE</version>
</parent>
<properties>
<!-- Stand-alone RESTFul application for testing only -->
<start-class>io.pivotal.microservices.services.Main</start-class>
</properties>
<dependencies>
<dependency>
<!-- Setup Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<!-- Setup Spring MVC & REST, use Embedded Tomcat -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<!-- Setup Spring Data common components -->
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<!-- Testing starter -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<!-- Setup Spring Data JPA Repository support …Run Code Online (Sandbox Code Playgroud) 我正在尝试将 spring-cloud-gateway 用于基于 spring-boot 的服务,该服务使用 ssl 和客户端身份验证。
问题是,通过 api 网关从客户端调用服务总是失败,并显示“certificate_unknown”(没有网关也可以正常工作)。
spring-cloud-gateway 似乎没有将客户端证书转发到后端服务。
有什么想法如何实现这一目标?这是缺少的功能吗?
谢谢
ssl client-certificates spring-cloud ssl-client-authentication api-gateway
我目前有两个服务正在 Eureka 服务器上注册,分别为 RESTAURANT 和 MENU。

这些名称在每个服务的 boostrap.yml 文件中定义为:
spring:
application:
name: menu
Run Code Online (Sandbox Code Playgroud)
然而,当涉及到使用Netflix的Feign时,我在注释中输入应用程序名称,如下所示:
@FeignClient("MENU")
public interface MenuClient {
@RequestMapping(value = "/restaurants/{restaurantId}/menu", method = RequestMethod.GET, consumes = "application/json")
public Menu getMenu(@PathVariable("restaurantId") final Long restaurantId);
}
Run Code Online (Sandbox Code Playgroud)
这最终导致 URL 没有映射到 eureka 服务,而是映射到http://MENU。

我确认,如果我在注释中对 url 进行硬编码,那么假客户端可以工作,但这会阻止我为我的服务生成随机端口。
我在这里缺少什么?该假冒客户位于 RESTAURANT 服务中。
我的餐厅服务主课
@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
@EnableFeignClients
public class RestaurantApplication {
public static void main(String[] args) {
SpringApplication.run(RestaurantApplication.class, args);
}
}
Run Code Online (Sandbox Code Playgroud) spring-cloud ×10
spring-boot ×6
spring ×5
java ×2
amazon-sqs ×1
api-gateway ×1
git ×1
logback ×1
maven ×1
pom.xml ×1
ssl ×1
turbine ×1