0
我添加了一個自定義的UserDetails和UserDetailsService類到我的春天項目,並希望與httpbasic結合使用它們。我如何配置spring來使用我的自定義類?春天安全UserDetailsService配置
我application.yml看起來是這樣的:
security:
basic:
enabled: false
require_ssl: false
enable_csrf: false
ignored:
- /register/**
- /acitivate/**
headers:
hsts: domain
sessions: stateless
的UserDetailsService:
@Service
@Transactional(readOnly = true)
public class UserDetailsServiceAdapter implements UserDetailsService {
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//...
}
}
我一定要定義豆類,或是否有可能我application.yml內設置呢?