I has class like this:
@Service(\"userDetailsService\")
public class MyUserDetailsService implements UserDetailsService {
...
and trying t
just import the other xml file in the spring-security.xml by using <beans:import resource="" />
another thing u can do is that load all the xml files in the web.xml file using
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
path to the xml files separated by commas
</param-value>
</context-param>
If you use annotations to specify your beans, you need to have add an entry to your config to scan the classpath for them.
<context:component-scan base-package="org.example"/>
You are missing schema location for context.
So your xml should start with:
<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"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
@Service
extends @Component
which allows for classpath scanning
.
You can enable both classpath scanning
and annotations
<context:annotation-config />
<context:component-scan base-package="com.package.a,com.b" />
I don't know what version are you using. Try this.
<authentication-manager>
<authentication-provider user-service-ref="userDetailsService">
<!-- <password-encoder hash="md5" /> -->
</authentication-provider>
</authentication-manager>
Unless you provide, as you do, a name, it will be the class name. But you provide the same name it would be but stating another in the config file.
If you @Service
with no name then it would be fine.