Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpringBoot Nacos 动态刷新错误使用 SpringCloud Nacos 类 #1002

Closed
lbx-aike opened this issue Nov 21, 2022 · 1 comment · Fixed by #1010
Closed

SpringBoot Nacos 动态刷新错误使用 SpringCloud Nacos 类 #1002

lbx-aike opened this issue Nov 21, 2022 · 1 comment · Fixed by #1010
Assignees
Labels
in: hippo4j-config type: bug Something isn't working
Milestone

Comments

@lbx-aike
Copy link

报错日志

Caused by: java.lang.ClassNotFoundException: com.alibaba.cloud.nacos.NacosConfigProperties
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 25 common frames omitted

hippo4j使用版本

hippo4j-config-1.4.3 版本
hippo4j 使用版本

        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
            <version>2.2.5.RELEASE</version>
            <optional>true</optional>
        </dependency>

项目环境

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath/>
    </parent>
    <dependency>
        <groupId>com.alibaba.boot</groupId>
        <artifactId>nacos-config-spring-boot-starter</artifactId>
        <version>0.2.1</version>
    </dependency>

源码问题位置

image

问题

因为我们没有引入spring cloud,所以使用spring boot引入nacos使用hippo4j config会报错,@NacosInjected这个注解就会把nacos的configService注入,为什么还要用构造方法使用spring cloud nacos的类注入,我把这几行代码删除之后,打包到私服,然后在项目里使用也没有问题,所以这里构造方法注入是为了解决什么问题?

@magestacks magestacks added type: bug Something isn't working in: hippo4j-config labels Nov 21, 2022
@magestacks magestacks added this to the 1.5.0 milestone Nov 21, 2022
@magestacks magestacks changed the title NacosConfigProperties类未找到异常 SpringBoot Nacos 动态刷新错误使用 SpringCloud Nacos 类 Nov 21, 2022
@magestacks
Copy link
Member

已确认为问题,可以使用 1.4.1 版本或者等待 1.4.3 修复版本

@BigXin0109 BigXin0109 mentioned this issue Nov 23, 2022
magestacks pushed a commit that referenced this issue Nov 26, 2022
* fix: #10002

* fix: #10002

* feat: remove debug

* feat: format

* feat: format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: hippo4j-config type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants