Spring security setting using beans annotation

I am trying to configure spring protection to use a service that I implemented for authentication. My services and entity manager and everything that is configured with annotations. I do not want to move the entire configuration of the service, dao and entity manager to XML. How can I configure the authenticator provider for a bean service link that is configured only through annotations?

Here is the configuration in xml

<authentication-manager>
    <authentication-provider user-service-ref="userService" />
</authentication-manager>

And here is the service definition

@Configurable
@Service( value = "userService" )
public class UserServiceImpl
        extends BaseDataServiceAbstract<User, Long>
        implements UserService
{
+3
source share
1 answer

If you just add this to your XML:

<context:component-scan base-package="org.package.where.your.beans.are"/>

Spring beans .

:

+3

Source: https://habr.com/ru/post/1769076/


All Articles