chandan sah
chandan sah

Reputation: 59

The prefix "context" for element "context:annotation-config" is not bound

I am trying to use to make my Spring application work with annotations. But I am getting an error: that the prefix "context" for element "context:annotation-config" is not found.

Can anyone tell what the root cause for this is.

Upvotes: 1

Views: 4042

Answers (1)

R.G
R.G

Reputation: 7121

You are missing the required xml name space entries

Spring reference documentation

make sure you context.xml is similar to the following

<?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:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        https://www.springframework.org/schema/context/spring-context.xsd">

    <context:annotation-config/>

</beans>

Upvotes: 5

Related Questions