还没入门的小白一枚,正在学习Spring Boot 整合MyBatis,代码什么的都没问题了,数据库也是连接成功的,就是接口测试,在浏览器上实现eclipse给数据库“添加成功”的时候出现:
就一直无法解决,网上也没搜到对应的有效解决方法,跪求大佬指点,呜呜呜
我的接口测试代码是:
package com.example.demo.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.example.demo.entity.Article;
import com.example.demo.dao.ArticleMapper;
@RestController
public class HelloController {
@Autowired
private ArticleMapper ArticleMapper;
@GetMapping("/add")
public String add() {
Article article = new Article();
article.setContent("sasi");
article.setTitle("123");
ArticleMapper.insertIntoArticle(article);
return "添加成功!";
}
}
在访问 /add 的时候没有警告啥的吗?如果没有的话,你就把你的配置发一下,controller 怎么写的发一下
你检查一下后台是不是有报错信息
信息太少了,只有404找不到映射
后台是运行成功了的
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,欢迎您加入CSDN!
目前问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632