There is already ‘xxxController‘ bean method

1、报错信息

com.xxx.xxx.controller.DemoController#testGetRedisObject()
to {GET /blog/tro}: There is already 'demoController' bean method

2、解决方案

网上提到的解决方案:

There is already ‘xxxController‘ bean method_第1张图片

但是我的没好使,最后发现是GetMapping中的路径重复了

@ApiOperation(value = "测试Redis获取String数据")
@GetMapping("/tro")
@ResponseBody
public String testGetRedisString(){
    return redisUtils.getValueForKey("key1");
}

@ApiOperation(value = "测试Redis插入对象数据")
@GetMapping("/tro")
@ResponseBody
public void testSetRedisObject(){
    BlogUser blogUser = new BlogUser();
    blogUser.setNickname("xiaodming");
    blogUser.setEmail("东方红一号@qq.com");
    redisUtils.addKeyAndObject("key2",blogUser);
}

修改成不一样的即可

你可能感兴趣的:(JAVA,java,SpringBoot)