• endpoint.

    The following example, illustrates the @Refreshable scope behavior.

    1. @Refreshable (1)
    2. static class WeatherService {
    3. @PostConstruct
    4. forecast = "Scattered Clouds ${new SimpleDateFormat("dd/MMM/yy HH:mm:ss.SSS").format(new Date())}" (2)
    5. }
    6. String latestForecast() {
    7. return forecast
    8. }
    9. }

    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:

    1. applicationContext.publishEvent(new RefreshEvent());