Description:spring
Field testService in com.xxx.xxx.api.controller.TestController required a bean of type 'com.xxx.xxx.service.TestService' that could not be found.api
Action:maven
Consider defining a bean of type 'com.xxx.xxx.service.TestService' in your configuration.ide
1.maven多模塊啓動類:ui
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"com.xxx.xxx.service","com.xxx.xxx.api.controller"})
或
@SpringBootApplication(scanBasePackages = {"com.xxx.xxx.**"})
2.TestService類加註解@Serviceip
另外,暴力方法:io
@Autowired
TestService testService;
改成
TestService testService = new TestService();可是,這樣就不歸spring管理了