【发布时间】:2019-08-02 04:44:09
【问题描述】:
API 在没有 spring-boot 的情况下工作,但在 spring-boot 下就不行了。
@RequestMapping("/operationsOnEmployee")
@RestController
public class OperationsOnEmployee {
@Autowired
EmployeeFacade employeeFacade;
@GetMapping(produces = "application/json")
public List<Employee> getEmployee() {
System.out.println("hello");
return employeeFacade.getAllEmployee();
}
application.properties
server.port:8080
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect
spring.datasource.url=jdbc:mysql://localhost:3306/company
spring.datasource.username=root
spring.datasource.password=root
"timestamp": "2019-08-01T11:34:07.631+0000", "status": 404, "error": "Not Found", "message": "No message available", "path": "/operationsOnEmployee"
【问题讨论】:
-
发布你的包结构和扫描所有包的应用程序类
-
我没有将我的主文件和控制器放在同一个包中。现在它工作正常。
-
将文件放入同一个包后,现在可以正常工作了吗?
标签: spring rest spring-boot