繁体   English   中英

"获取资源未找到 404 即使 URL 是正确的 spring boot"

[英]Getting resource not found 404 even URL is correct spring boot

部门控制器

@RestController
public class DepartmentController {
    
    @Autowired
    DepartmentControllerConsumer departmentService;
   
    @GetMapping("/departments")
    public ResponseEntity<List<DepartmentResponse>> getAllDepartments() {
        ResponseEntity<List<DepartmentResponse>> departments = departmentService.getAllDepartmentsUsingClient();
        return  departments;
    } 

}

是的,如果您的控制器类与源包不在同一个包中,您可能需要将它们放在同一个包中或使用@ComponentScan<\/code>扫描您的包:)

"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM