首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何修复Spring-boot中的“白标错误页”

如何修复Spring-boot中的“白标错误页”
EN

Stack Overflow用户
提问于 2019-04-21 14:58:07
回答 1查看 118关注 0票数 0

我尝试通过Spring-boot来做API webservice,但是我得到了一个错误:“白色标签错误页这个应用程序没有显式的/error映射,所以你认为这是一种退路。

Sun Apr 21 13:42:49 ICT 2019出现意外错误(type=Not Found,status=404)。没有可用的消息“

代码语言:javascript
运行
复制
ArrestGetByConApplication.java : 

package com.arrestbycon.arrestGetByCon;
import org.springframework.boot.SpringApplication; 
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan
public class ArrestGetByConApplication {

public static void main(String[] args) {
    SpringApplication.run(ArrestGetByConApplication.class, args);
}

}

and some of my controller :

package com.arrestbycont.arrestGetByCon;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.sql.*;
import java.util.ArrayList;
import com.arrestbycon.arrestGetByCon.Result;

@RestController
public class GetByCon {

    @RequestMapping(value = "/test", method = RequestMethod.GET)   
    public ArrayList<Result> getResult() {
      Integer arr_id;
      Integer off_id;
      String arr_code;
      String off_code;
      String off_name;

      ArrayList<Object> myArrlist = new ArrayList<Object>();
EN

回答 1

Stack Overflow用户

发布于 2019-04-21 17:39:15

“白标页面”本身并不是一个错误,而是Spring返回的模板,以防出现没有其他自定义处理的错误。

在前面提到的这个特定情况下,错误显然是您试图访问的控制器端点不存在(因此出现了404代码)。只需确保您使用正确的HTTP方法对正确的端点进行API调用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55780615

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档