Prefix “context” for element “context:component-scan” or “context:annotation-config” is not bound : Spring error

Previous
Next
When you are working on spring or spring mvc application, you may encounter below error message.
org.xml.sax.SAXParseException: The prefix “context” for element “context:component-scan” is not bound .
or
org.xml.sax.SAXParseException: The prefix “context” for element “context:annotation-config” is not bound .

This issue generally occurs when you do not include context namespace.

For example: Lets say you have below xml configuration file.

Here you might get above exception because you are missing context namespace xmlns:context here.
When you add below line in above xml.

so your final xml file will look as below:

I hope it will solve context is not bound error.

Previous
Next

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.

Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog