使用@Value註解的配置會自動刷新配置spring
@Component("systemConfig") @ConfigurationProperties(prefix = "cword") @RefreshScope @EnableApolloConfig("cword") public class SystemConfig { private Resource filePath; private Resource tempFilePath; @Autowired private org.springframework.cloud.context.scope.refresh.RefreshScope refreshScope; @ApolloConfigChangeListener("cword") private void configChange(ConfigChangeEvent changeEvent){ refreshScope.refresh("systemConfig"); } }