[英]Application Run Failed in SpringBoot
我正在通過教程學習 SpringBoot,為公司的員工數據庫構建一個帶有 API 的示例網站。 當我嘗試運行該應用程序時,我收到以下消息:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadDatabase' defined in file [/Users/westonjorgensen/Downloads/payroll/target/classes/com/company/payroll/LoadDatabase.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.company.payroll.LoadDatabase$$EnhancerBySpringCGLIB$$6abc07cf]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems:
The declared package "payroll" does not match the expected package "com.company.payroll"
The method save(Employee) is undefined for the type EmployeeRepository
The method save(Employee) is undefined for the type EmployeeRepository
整個項目在這里https://github.com/wjorgensen/payroll.git
我正在關注的教程是https://spring.io/guides/tutorials/rest/
關於如何解決問題的任何想法?
包裹有問題。
異常提到<...>/com/company/payroll/LoadDatabase.class
但您的項目在src/main/java/com/company/payroll
中不包含LoadDatabase.java
類。 嘗試將所有類從com.company.payroll
包移動到payroll
包,如您所遵循的教程中所述。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.