Spring boot @GetMapping在Spring引导中运行良好,但在Postman中返回错误404

Spring boot @GetMapping在Spring引导中运行良好,但在Postman中返回错误404,spring-boot,spring-data-jpa,get,postman,restapi,Spring Boot,Spring Data Jpa,Get,Postman,Restapi,我使用JPA从postgres获取数据。我在数据库smartbank中创建了一个表,并相应地创建了模型类。现在,在sts中一切正常,没有错误,tomcat服务器启动,但是当我转到postman,使用get方法时,它显示状态:404。 请在下面查找控制器的代码: package com.scb.smartbank.model.controller; import java.util.List; import org.springframework.beans.factory.annotation.

我使用JPA从postgres获取数据。我在数据库smartbank中创建了一个表,并相应地创建了模型类。现在,在sts中一切正常,没有错误,tomcat服务器启动,但是当我转到postman,使用get方法时,它显示状态:404。 请在下面查找控制器的代码:

package com.scb.smartbank.model.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.scb.smartbank.model.Model;
import com.scb.smartbank.service.Service;
@RestController
@CrossOrigin
public class Controller {
    @Autowired
    Service service;
    @GetMapping("/getdata")
    List<Model> getDetails(){
        return service.findAll();
    }
}
服务接口代码:

package com.scb.smartbank.service;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import com.scb.smartbank.model.Model;

@Repository
public interface Service extends JpaRepository<Model,Integer>{
    @Override
    List<Model> findAll();

}
现在,当我在Postman中使用http://localhost:8086/getdata,我发现以下错误:

{
"timestamp": "2020-12-19T07:07:13.639+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/getdata"
}

请提前帮助并感谢您。

启动Spring Boot应用程序时,是否输出
Tomcat在端口8086(http)上启动,上下文路径为“”
启动Spring Boot应用程序时,是否输出
Tomcat在端口8086(http)上启动,上下文路径为“”
server.port = 8086
spring.datasource.url=jdbc:postgresql://localhost:5432/smartbank
spring.datasource.username=postgres
spring.datasource.password=postgres
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
spring.jpa.show-sql=true 
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
spring.jpa.hibernate.ddl-auto = update
spring.main.allow-bean-definition-overriding=true
{
"timestamp": "2020-12-19T07:07:13.639+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/getdata"
}