我知道這個(gè)問題已經(jīng)被問過很多次了,但我真的很難找到正確的解決方案。通過看到這些問題,我嘗試了很多東西,但似乎沒有一個(gè)適合我的情況。這是我目前的實(shí)現(xiàn):SpringBoot應(yīng)用程序:@SpringBootApplication@EnableJpaRepositories(basePackages="com.timmi.springBoot.repositories")@EntityScan(basePackages="com.timmi.springBoot.entities")@EnableAutoConfiguration@ComponentScan(basePackages="com.timmi.springBoot.service")public class Application extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { // TODO Auto-generated method stub return super.configure(builder); }}休息控制器:@RestController@RequestMapping("/app")public class RestEndPoints { @Value("${default.course.name}") private String cName; @Value("${default.course.chapterCount}") private int chaptersCount; @Autowired private CourseConfiguration courseConfiguration; @Autowired private DashboardService dashboardService; @RequestMapping("/employees") public List<EmployeeInformation> getAllEmpl(){ return dashboardService.getAllEmployee(); }}儀表板服務(wù)接口:public interface DashboardService{ List<CompanyRevenue> getTodayRevenueDash(); List<ProductCategory> getBestCategory(); List<OrderRecieved> getAllOrderRecieved(); List<OrderCollectionStatus> getOrderCollection(); List<EmployeeInformation> getAllEmployee(); void addEmployee(EmployeeInformation employeeInformation); EmployeeInformation updateEmployee(EmployeeInformation employeeInformation); void deleteEmployee(EmployeeInformation employeeInformation);}
通過字段“dashboardService”表達(dá)的不滿意的依賴;
ibeautiful
2021-09-29 17:12:43