Spring security http and authentication-provider not declared

spring, spring-security

Solution

MaKe these changes

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/security
        http://www.springframework.org/schema/security/spring-security-3.1.xsd">

  <http auto-config='true'>
    <intercept-url pattern="/messagePost.htm*" access="ROLE_USER"/>
  </http>

  <authentication-manager>
    <authentication-provider>
      <user-service>
        <user name="user1" password="1111" authorities="ROLE_USER"/>
      </user-service>
    </authentication-provider>
  </authentication-manager>

</beans:beans>

I have done the following changes

- Changed your xmlns schema from `"http://springframework.org/schema/security"`to `"http://www.springframework.org/schema/security"` (added www :D)

- I have enclosed the `<authentication-provider>` namespace inside a `<authentication-manager>` namespace.

Problem

I was trying to integrating Spring security into my existing project. The tools that I am using are: - Spring 2.5.6.SEC03 - spring-security-core 3.1.1.RELEASE - JDK 7. In spring configuration, I have this: ``` <beans:beans xmlns="http://springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <http auto-config='true'> <intercept-url pattern="/messagePost.htm*" access="ROLE_USER"/> </http> <authentication-provider> <user-service> <user name="user1" password="1111" authorities="ROLE_USER"/> </user-service> </authentication-provider> </beans:beans> ``` But there is an error on this spring configuration: - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'authentication-provider'. - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'http'. May I know how to resolve this issue?

Original source