请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

/bus/refresh刷新无用的问题,rabbitmq里收不到配置中心的消息

师兄好,
我的springboot的版本和springcloud的版本都和你代码里的一样,
但项目跑起来后除非重启才能取到gitlab里的最新配置。 访问/bus/refresh能访问到,并且config的console里会打印:

2019-09-25 10:03:49.215  INFO 32687 --- [nio-8081-exec-3] .c.s.e.MultipleJGitEnvironmentRepository : Fetched for remote master and found 1 updates
2019-09-25 10:03:49.245  INFO 32687 --- [nio-8081-exec-3] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@65b53436: startup date [Wed Sep 25 10:03:49 CST 2019]; root of context hierarchy
2019-09-25 10:03:49.247  INFO 32687 --- [nio-8081-exec-3] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-09-25 10:03:49.251  INFO 32687 --- [nio-8081-exec-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@65b53436: startup date [Wed Sep 25 10:03:49 CST 2019]; root of context hierarchy

明显已经取得了最新的修改,但就是rabbit里没有消息 ,order项目访问也得不到最新的配置。
不知道问题出在哪里? 我已经试了好几个boot和cloud的版本都是一样的现象。
下面是我的配置:
config项目pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.6.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.fshd</groupId>
    <artifactId>xpoconf</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>xpoconf</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.SR2</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bus-amqp</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-monitor</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

正在回答 回答被采纳积分+3

4回答

I_m_on_my_way 2021-03-07 12:27:21

楼主的问题解决了没有,我也遇到了相同的问题,求赐教!!!

0 回复 有任何疑惑可以回复我~
廖师兄 2019-09-26 21:50:49

看13-5视频

0 回复 有任何疑惑可以回复我~
提问者 weixin_慕移动9064827 2019-09-25 10:01:27

Get访问/actuator/bus-refresh,/bus/refresh  问题一样。Post返回405。

0 回复 有任何疑惑可以回复我~
提问者 weixin_慕移动9064827 2019-09-24 22:52:20

rabbitmq里能看到两个queen。确认是config和order两个项目的。

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号