nacos-group / nacos-spring-boot-project

Nacos ECO Project for Spring Boot
Apache License 2.0
789 stars 424 forks source link

Using dataids field causes NullPointerException #320

Closed Guofuyinan closed 9 months ago

Guofuyinan commented 10 months ago

Using dataids field causes NullPointerException

nacos-config-spring-boot-starter version

<groupId>com.alibaba.boot</groupId>
<artifactId>nacos-config-spring-boot-starter</artifactId>
<version>0.3.0-RC</version>

spring-boot-starter-parent version

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.0</version>

properties

nacos:
  config:
    ...
    data-ids: a,,b
    ...

exception

java.lang.NullPointerException: Cannot invoke "org.springframework.core.env.PropertySource.containsProperty(String)" because "propertySource" is null
    at org.springframework.core.env.PropertySourcesPropertyResolver.containsProperty(PropertySourcesPropertyResolver.java:51)
    at org.springframework.core.env.AbstractEnvironment.containsProperty(AbstractEnvironment.java:546)
    at org.springframework.boot.logging.log4j2.SpringEnvironmentPropertySource.containsProperty(SpringEnvironmentPropertySource.java:55)
    at org.apache.logging.log4j.util.PropertiesUtil$Environment.get(PropertiesUtil.java:530)
    at org.apache.logging.log4j.util.PropertiesUtil$Environment.access$200(PropertiesUtil.java:444)
    at org.apache.logging.log4j.util.PropertiesUtil.getStringProperty(PropertiesUtil.java:392)
    at org.apache.logging.log4j.util.PropertiesUtil.getBooleanProperty(PropertiesUtil.java:165)
    at org.apache.logging.log4j.util.PropertiesUtil.getBooleanProperty(PropertiesUtil.java:154)
    at org.apache.logging.log4j.core.jmx.Server.isJmxDisabled(Server.java:131)
    at org.apache.logging.log4j.core.jmx.Server.unregisterLoggerContext(Server.java:244)
    at org.apache.logging.log4j.core.LoggerContext.stop(LoggerContext.java:364)
    at org.apache.logging.log4j.core.AbstractLifeCycle.stop(AbstractLifeCycle.java:136)
    at org.springframework.boot.logging.log4j2.Log4J2LoggingSystem.lambda$getShutdownHandler$2(Log4J2LoggingSystem.java:446)
    at java.base/java.lang.Iterable.forEach(Iterable.java:75)
    at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:110)
    at java.base/java.lang.Thread.run(Thread.java:833)

I think the program should be robust enough to deal with some abnormal situations