package com.lizongbo.tomcatdemo; import java.time.LocalDateTime; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class DemoController { private static final Log logger = LogFactory.getLog(DemoController.class); @Autowired private DemoTestSmartLifecycle demoTestSmartLifecycle; @RequestMapping("/hello") public String hello() { logger.info("runHello"); return "hello"+ LocalDateTime.now() +"|isRunning=" + demoTestSmartLifecycle.isRunning() + "|isOnrefreshed=" + demoTestSmartLifecycle.isOnrefreshed() + "|isOnStarted=" + demoTestSmartLifecycle.isOnStarted(); } }