我正在我的应用程序中实现令牌授权系统。
配置完所有内容后,我转到findById(@PathVariable("id") Long id)
,但出现500错误。
我插入完整的错误以及出现错误的类。
https://pastebin.com/SUWDmCRD(错误)localhost:8080/aut_svr/oauth/token
https://pastebin.com/NgVAukv8(Java类)
enter code here
https://pastebin.com/49HNWERP(Java第2类)
package it.eng.tz.template.application.commons.repository;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Root;
import org.springframework.stereotype.Repository;
import it.eng.tz.template.application.commons.persistence.models.OauthClientDetails;
import it.eng.tz.template.application.commons.persistence.models.Operatore;
@Repository
public class OauthClientDao extends AbstractDao<String, OauthClientDetails> {
/**
* {@inheritDoc}
*/
@Override
protected Class<OauthClientDetails> getPersistentClass() {
return OauthClientDetails.class;
}
/**
* Effettua la ricerca di un {@link OauthClientDetails} in base alla username
* @param clientId -la username dell'operatore
* @return - {@link Operatore} trovato
*/
public OauthClientDetails findByClientId( String clientId ) {
CriteriaBuilder cb = createCriteriaBuilder();
CriteriaQuery<OauthClientDetails> query = cb.createQuery(OauthClientDetails.class);
Root<OauthClientDetails> root = query.from(OauthClientDetails.class);
root.fetch("auths", JoinType.INNER);
query.select(root);
query.where(cb.equal(root.get("clientId"), clientId));
OauthClientDetails result = getSession().createQuery(query).getSingleResult();
return result;
}
}