Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring启动应用程序无法热交换更改_Java_Spring_Spring Boot_Intellij Idea - Fatal编程技术网

Java Spring启动应用程序无法热交换更改

Java Spring启动应用程序无法热交换更改,java,spring,spring-boot,intellij-idea,Java,Spring,Spring Boot,Intellij Idea,我正在做一个Spring Boot项目,我试图将我们的IDE从STS切换到Intellice。除调试时外,一切正常。每当我更改Java类时,Spring都会尝试重新启动整个应用程序,但失败时会显示以下消息: web - 2018-09-27 08:39:18,494 [restartedMain] WARN o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context

我正在做一个Spring Boot项目,我试图将我们的IDE从STS切换到Intellice。除调试时外,一切正常。每当我更改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启动运行配置中有一个选项,可以在重新启动应用程序上下文之前尝试热交换:


正确的触发器文件选项将自动添加到命令行。

您的
UserService
是否用
@Service
注释?你能用类签名扩展你的问题,包括它们的注释吗?你能启动你的应用程序吗?或者您在热插拔功能方面有问题?@HakanDilek是的,正如关于环境的第7条所指出的。此外,应用程序启动正常,并处理请求。当我在调试已在执行的应用程序时尝试更改某些内容时,就会出现此问题。可能是您遗漏了任何注释,可能是
@Controller
@RestController
上的
@UserController
@Service
上的
@Service
更新了帖子描述。控制器似乎设置正确。 com.xyz |-service | |-IUserService | |-impl | |-UserService |-controller |-UserController @Autowired private IUserService userService
@org.springframework.web.bind.annotation.RestController
@RequestMapping(value = "/user", produces = MediaType.APPLICATION_JSON_VALUE)
public class UserController{

    @Autowired
    private IUserService userService;
    ...
}