機能・要件 
 構成・方式 
    Spring Security
 タスク 
 Spring Security
 ・独自のDB認証用のUserDetailsServiceをSpring Securityに適用する
 ・@Service // コンポーネントスキャン機能でDIコンテナに登録すれば自動検出される
package xxxx.domain.service.userdetails; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import xxxx.domain.model.UsrData; import xxxx.domain.service.user.UsrService; @Service public class SampleUserDetailsService implements UserDetailsService { @Autowired UsrService usrService; @Override public UserDetails loadUserByUsername(String userId) throws UsernameNotFoundException { try { UsrData usrData = usrService.findOne(userId); System.out.println("userId = " + usrData.getUserId()); return new SampleUserDetails(usrData); } catch (Exception e) { throw new UsernameNotFoundException("user not found", e); } } }