将bean类转移到另一个包

时间:2018-04-04 00:19:03

标签: java spring

我在AuthorizationServiceImpl包中的web模块中有security类,它是bean https://github.com/JonkiPro/REST-Web-Services/blob/master/web/src/main/java/com/web/web/security/service/impl/AuthorizationServiceImpl.java。在我最新版本的项目中,我将AuthorizationServiceAuthorizationServiceImpl类移到了core模块。您可以在屏幕https://zapodaj.net/866eab42f00f0.png.html上看到它。但是,IntelliJ在编译期间抛出了一个错误

2018-04-04 02:10:15.578  WARN 1688 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.web.WebApplication]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'authorizationService' for bean class [com.core.service.impl.AuthorizationServiceImpl] conflicts with existing, non-compatible bean definition of same name and class [com.web.web.security.service.impl.AuthorizationServiceImpl] As if IntelliJ did not know that I moved the class to another package and throws me into conflict with the previous place, but the class is not there anymore.

你如何让IntelliJ知道班级被移动了?

1 个答案:

答案 0 :(得分:0)

这是第1行的问题:

package com.web.web.security.service.impl;