【发布时间】:2019-09-10 19:59:04
【问题描述】:
我尝试通过 Spring-boot 做 API webservice 但我得到一个错误 “白标错误页面 此应用程序没有 /error 的显式映射,因此您将其视为后备。
2019 年 4 月 21 日星期日 13:42:49 ICT 出现意外错误(类型=未找到,状态=404)。 没有可用的消息”
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>();
【问题讨论】:
-
你能更精确一点吗?您想自定义错误页面吗?或者你不明白为什么你有这个答案?
标签: api spring-boot