I have an xml config and when I try to import spring-security namespace it gives me 2 choices: springframework.org/schema/p
and springframework.org/schema/c
. What I need is: http://www.springframework.org/schema/security (which cannot be found). It is a spring boot project and I need to configure security with xml. I think I am missing some dependecy but i am not sure which one.
This is the xml config file:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd"
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
And build.gradle dependencies:
dependencies {
compile('org.springframework.boot:spring-boot-starter-aop')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.postgresql:postgresql')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.security:spring-security-test')
compile group: 'org.springframework', name: 'spring-jdbc', version: '5.0.6.RELEASE'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.0'
compile group: 'org.springframework.security', name: 'spring-security-config', version: '5.0.5.RELEASE'
}
You're missing the spring security namespace link at the top of your xml file and you've an extra quote in the schema links on the bottom part. Try adding the following to the xml file exactly as it is below here:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
</beans>