Commit 3cbe8afb authored by 曾水平's avatar 曾水平

增加心跳

parent edda2979
package cn.com.duiba.jdactivity.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 心跳
*
* @author zsp (zengshuiping@duiba.com.cn)
* @date 2021/5/12 15:26
*/
@RestController
@RequestMapping("/heart")
public class HeartController {
@RequestMapping("")
public String heart() {
return "success";
}
}
\ No newline at end of file
package cn.com.duiba.jdactivity.controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
/**
* @author zsp (zengshuiping@duiba.com.cn)
* @date 2021/5/12 15:26
*/
@Controller
@RequestMapping("/hello")
public class HelloController {
public static final Logger LOGGER = LoggerFactory.getLogger(HelloController.class);
@Resource(name = "stringRedisTemplate")
private StringRedisTemplate stringRedisTemplate;
@RequestMapping("/testRedis")
@ResponseBody
public String testRedis(String value) {
LOGGER.info("testRedis");
stringRedisTemplate.opsForValue().set("test_key", value);
return stringRedisTemplate.opsForValue().get("test_key");
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment