E-Riz
E-Riz

Reputation: 32914

How to eliminate bogus "Referenced bean ... not found" warnings in STS?

STS (3.6.1 and others), Spring 4.1.x (latest), Spring Integration 4.1.2

In many Spring projects I work on in Eclipse/STS, we have numerous "Referenced bean not found" warnings. These often refer to internal Spring beans/classes, not legitimate mis-configuration of our own beans.

Here's an example from one of our Spring Data JPA configurations:

Referenced bean 'jpaMappingContext' not found [config set: c-r-core/primary]

The relevant configuration is just:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.5.xsd
    http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
    http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.3.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">

<!-- other stuff -->
<jpa:repositories base-package="com.xyz.persistence" />

In our Spring Integration configuration we get even more warnings:

Referenced bean 'Create Text$child.Build Transmission.handler' not found [config set: c-r-integration/primary]
Referenced bean 'Create Text$child.Store ControlNumber in Header.handler' not found [config set: c-r-integration/primary]
Referenced bean 'Create Text$child.Store Parameters in Header.handler' not found [config set: c-r-integration/primary]
Referenced bean 'Create Text$child.Write IC to String.handler' not found [config set: c-r-integration/primary]
Referenced bean 'FilePoller.source' not found [config set: c-r-integration/primary]
Referenced bean 'org.springframework.integration.channel.interceptor.WireTap#0' not found [config set: c-r-integration/primary]
Referenced bean 'org.springframework.integration.channel.interceptor.WireTap#0' not found [config set: c-r-integration/primary]
Referenced bean 'org.springframework.integration.channel.interceptor.WireTap#0' not found [config set: c-r-integration/primary]
Referenced bean 'org.springframework.integration.handler.MessageHandlerChain#0$child.Store GS info in Header.handler' not found [config set: c-r-integration/primary]
Referenced bean 'org.springframework.integration.handler.MessageHandlerChain#0$child.Store IC info in Header.handler' not found [config set: c-r-integration/primary]
Referenced bean 'org.springframework.integration.json.JsonToObjectTransformer#0' not found [config set: c-r-integration/primary]
Referenced bean 'org.springframework.jms.listener.DefaultMessageListenerContainer#0' not found [config set: c-r-integration/primary]
Referenced bean 'org.springframework.jms.listener.DefaultMessageListenerContainer#0' not found [config set: c-r-integration/primary]
Referenced bean 'org.springframework.scheduling.support.PeriodicTrigger#0' not found [config set: c-r-integration/primary]

It seems that the more we use Spring Integration namespaces the more of these show up.

There are other related questions in the old STS forums and a few on SO, like this one whose accepted answer is no help at all. I've tried multiple iterations of cleaning, enabling and disabling the Spring Bean Reference validation, but no matter what I do these bogus warnings always come back when the validation is enabled.

To repeat, these are not actual problems due to mis-configuration, or to the "import support" feature in STS (as described here). And the apps behave correctly at runtime; this is clearly an STS-only issue.

We strive to keep our projects clean of all warnings, so these are very cluttering and hide legitimate warnings that really do need our attention.

Is there any way to troubleshoot these and eventually eliminate them? Are they even all due to the same underlying problem, or are there different issues at play here?

Upvotes: 1

Views: 1928

Answers (1)

Gary Russell
Gary Russell

Reputation: 174564

They are most likely issues with the namespace parsers; I am not sure we can address them all but, I agree, it would be nice if we could eliminate these false warnings.

Please go ahead and open a JIRA Issue against Spring Integration for now and, if needed, we'll talk to the STS team.

(For the jpa issue, you should open a jira against Spring Data).

EDIT: I cannot reproduce the

Referenced bean 'org.springframework.integration.channel.interceptor.WireTap#0' not found [config set: c-r-integration/primary]

Can you provide a small test case?

Upvotes: 1

Related Questions