All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dxy.library.springboot.redis.rest.RedisTestRest Maven / Gradle / Ivy

The newest version!
package com.dxy.library.springboot.redis.rest;

import com.dxy.library.springboot.redis.redis.Redis;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author duanxinyuan
 * 2018/7/11 19:40
 */
@RestController
@RequestMapping(path = "/redis")
@Component
@Slf4j
public class RedisTestRest {

    @Autowired
    private Redis redis;

    @PostMapping("/test")
    public String set() {
        redis.set("test_dxy", "哈哈哈哈哈哈");
        return "设置成功";
    }

    @GetMapping("/test")
    public String get() {
        return redis.get("test_dxy");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy