Skip to content

Component scanning does not find sub-packages in EAR on Weblogic 12.2.x [SPR-14187] #18758

Closed
@spring-projects-issues

Description

@spring-projects-issues

Robson Vargas Farias opened SPR-14187 and commented

I've an EAR application which contains a simple message-driven bean that receive data from a queue on weblogic; this MDB is intercepted by SpringBeanAutowiringInterceptor in order to inject a @Autowired bean, but, I'm receiving an exception:

Caused By: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.test.beans.bo.SampleBO] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

My configuration is:

<context:component-scan base-package="com.test.beans" />

The strange is: if I change the base package to the exactly package where my bean is on it works fine. Sample:

<context:component-scan base-package="com.test.beans.bo" />

Suggesting that the issue is related to the sub-packages scanning.

my ref context:

<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">

	<bean id="myContext" class="org.springframework.context.support.ClassPathXmlApplicationContext">
		<constructor-arg value="/META-INF/app-config.xml" />
	</bean>
</beans>

my app config:

<?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" 
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util"
	xmlns:task="http://www.springframework.org/schema/task"
	xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans-4.0.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.0.xsd
	http://www.springframework.org/schema/util    http://www.springframework.org/schema/util/spring-util-4.0.xsd
	http://www.springframework.org/schema/task    http://www.springframework.org/schema/task/spring-task-4.0.xsd">

	<context:annotation-config />
	<context:component-scan base-package="com.test.beans" />

</beans>

Tested on: Weblogic version: 12.2.x and lastest versions of Spring 4.x and 5.x (as shared libraries)


Affects: 4.1.7

Issue Links:

1 votes, 4 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: bulk-closedAn outdated, unresolved issue that's closed in bulk as part of a cleaning process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions