79547087

Date: 2025-03-31 19:25:39
Score: 1.5
Natty:
Report link

https://stackoverflow.com/users/4449503/ravi-korni
You are my hero.
I have a mixture of modules. Some modules use annotations and some xml bean definition files. I ran into this problem because the xml bean definition file could not see/find the beans defined by @Component annotation from the different module.

I added the line:

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

However the line did not resolve correctly.
I also needed to add:

xmlns:context="http://www.springframework.org/schema/context"

to the beans definition.
After that I got the error:

The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'

Adding these two values to xsi:schemaLocation parameter solved my issue.

http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd

Here is the summary of my changes to the beans config:

<beans ... 
xmlns:context="http://www.springframework.org/schema/context" 
xsi:schemaLocation=...
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    ...
...

Finally, it works!

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @Component
  • Low reputation (1):
Posted by: Gayatry Devi