Я работаю над проектом Spring Boot и попытался переключить нашу IDE с STS на Intellij CE.Все работает нормально, кроме как при отладке.Всякий раз, когда я изменяю класс Java, Spring пытается перезапустить все приложение и завершается неудачей со следующим сообщением:
web - 2018-09-27 08:39:18,494 [restartedMain] WARN o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.xyz.service.IUserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
web - 2018-09-27 08:39:18,496 [restartedMain] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
web - 2018-09-27 08:39:18,498 [restartedMain] INFO o.a.catalina.core.StandardService - Stopping service [Tomcat]
web - 2018-09-27 08:39:18,524 [restartedMain] INFO o.s.b.a.l.AutoConfigurationReportLoggingInitializer -
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
web - 2018-09-27 08:39:18,871 [restartedMain] ERROR o.s.b.d.LoggingFailureAnalysisReporter -
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userService in com.xyz.controller.UserController required a bean of type 'com.xyz.service.IUserService' that could not be found.
Action:
Consider defining a bean of type 'com.xyz.service.IUserService' in your configuration.
Вот некоторый контекст о среде:
- Spring-boot-devtools 1.5.9 зависимость добавлена в наш pom.xml
Опция "Настройки-> Построение, Выполнение, Развертывание-> Компилятор-> Построить проект автоматически" проверена
Я попробовал отладку с опцией "cmd + shift + a-> Registry-> compiler.automake.allow.when.app.running", как проверено, так и не проверено
Версия IDE
Версия IDE
Версия родительского загрузочного подпружинника - 1.5.9.RELEASE
Следующая структура описывает иерархию классов:
com.xyz
|-service
| |-IUserService
| |-impl
| |-UserService
|-controller
|-UserController
UserService.java помечен @ org.springframework.stereotype.Service UserController имеет следующее поле:
@Autowired
private IUserService userService
Также я попробовал все ответыс этой темы но решить проблему не удалось.Кто-нибудь сталкивался с этой проблемой?Ожидаемое поведение заключается не в перезапуске всего приложения и горячей замене только измененных артефактов.
Редактирование:
Вот пример UserController:
@org.springframework.web.bind.annotation.RestController
@RequestMapping(value = "/user", produces = MediaType.APPLICATION_JSON_VALUE)
public class UserController{
@Autowired
private IUserService userService;
...
}