无法自动装配字段:自动装配依赖项的注入失败;嵌套的异常是org.springframework.beans.factory.BeanCreationException

时间:2019-03-27 19:51:02

标签: java

将XSD更改为可以正常使用的Web服务后,我遇到了此错误。我将字段从long更改为String,并且该类是由插件在我的资源文件夹中生成的。部署war文件后,出现错误。

我在存储库类上添加了@Repository,并在处理程序上添加了@Component,但是我仍然收到错误消息

Caused by: org.springframework.beans.factory.BeanCreationException: Could 
not autowire field: private abc.def.Handler abc.def.endpoint.handler; 
nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'HandlerImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private abc.def.repository.ConfigRepository abc.def.handler.impl.HandlerImpl.repository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configRepository': Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.annotation.AnnotatedElementUtils.findMergedAnnotation(Ljava/lang/reflect/AnnotatedElement;Ljava/lang/Class;)Ljava/lang/annotation/Annotation;
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:508)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)
    ... 95 more


@Endpoint
public class GetEndPoint {

/**
 * The logger instance.
 */
private static final Logger LOGGER = LoggerFactory.getLogger(GetEndPoint.class);

/**
 * The namespace uri property.
 */
private static final String NAMESPACE_URI = "http://aba.def/soap";

/**
 * The ServiceHandler instance.
 */
@Autowired
private GetHandler handler;


@PayloadRoot(namespace = NAMESPACE_URI, localPart = "getRequest")
public
@ResponsePayload
GetResponse getQuery(@RequestPayload final GetRequest request) {
    if (request == null) {
        LOGGER.error("Null request object");
        throw new IllegalArgumentException("request = null");
    }
    try {
        return handler.getQuery(request);
    } catch (final Exception exception) {
        LOGGER.error(String.format("UNHANDLED EXCEPTION: %s",
                        exception.getMessage()),
                exception);
        throw new RuntimeException(exception);
    }

}

}

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"id",
"working"
})
@XmlRootElement(name = "getProviderStatementResponse")
public class GetResponse {

@XmlElement(required = true)
protected String id; // changed this to String from long
protected boolean working;

// getters and setters

我需要无错误地部署并查询和点。我如何摆脱这个错误?

0 个答案:

没有答案