Revisei o código e esta conforme a aula, mas não consigo compilar o projeto por conta da class "AutenticacaoService"
package med.voll.api.domain.usuario;
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;
@Service
public class AutenticacaoService implements UserDetailsService {
@Autowired
private UsuarioRepository repository;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException{
return repository.findById(username);
}
}
Erro:
C:\Java\SpringBoot-Api_Rest\api\src\main\java\med\voll\api\domain\usuario\AutenticacaoService.java:17:36
java: incompatible types: java.lang.String cannot be converted to java.lang.Long
UsuarioRepository:
package med.voll.api.domain.usuario;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.security.core.userdetails.UserDetails;
public interface UsuarioRepository extends JpaRepository<Usuario, Long> {
UserDetails findByLogin(String login);
}
Quem puder me ajudar, obrigado.