endpoint.
The following example, illustrates the @Refreshable
scope behavior.
@Refreshable (1)
static class WeatherService {
@PostConstruct
forecast = "Scattered Clouds ${new SimpleDateFormat("dd/MMM/yy HH:mm:ss.SSS").format(new Date())}" (2)
}
String latestForecast() {
return forecast
}
}
When the /refresh
endpoint is invoked or a is published then the instance is invalidated and a new instance is created the next time the object is requested. For example:
applicationContext.publishEvent(new RefreshEvent());