Package com.alibaba.cloud.nacos.refresh
Class NacosContextRefresher
java.lang.Object
com.alibaba.cloud.nacos.refresh.NacosContextRefresher
- All Implemented Interfaces:
EventListener,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware,org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationReadyEvent>
public class NacosContextRefresher
extends Object
implements org.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationReadyEvent>, org.springframework.context.ApplicationContextAware
On application start up, NacosContextRefresher add nacos listeners to all application
level dataIds, when there is a change in the data, listeners will refresh
configurations.
- Author:
- juven.xuxb, pbting, freeman
-
Constructor Summary
ConstructorsConstructorDescriptionNacosContextRefresher(NacosConfigManager nacosConfigManager, NacosRefreshHistory refreshHistory) -
Method Summary
Modifier and TypeMethodDescriptionstatic longbooleanvoidonApplicationEvent(org.springframework.boot.context.event.ApplicationReadyEvent event) static voidvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) setNacosConfigProperties(NacosConfigProperties nacosConfigProperties) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
NacosContextRefresher
public NacosContextRefresher(NacosConfigManager nacosConfigManager, NacosRefreshHistory refreshHistory)
-
-
Method Details
-
getRefreshCount
public static long getRefreshCount() -
refreshCountIncrement
public static void refreshCountIncrement() -
onApplicationEvent
public void onApplicationEvent(org.springframework.boot.context.event.ApplicationReadyEvent event) - Specified by:
onApplicationEventin interfaceorg.springframework.context.ApplicationListener<org.springframework.boot.context.event.ApplicationReadyEvent>
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware
-
getNacosConfigProperties
-
setNacosConfigProperties
-
isRefreshEnabled
public boolean isRefreshEnabled()
-