본문 바로가기

DEV/JAVA

페이스북 로그인 스프링 (#12) bio field is deprecated for versions v2.8 and higher error (facebook spring)

반응형

Jhipster로 페이스북 로그인을 구현하던중 

(#12) bio field is deprecated for versions v2.8 and higher와 같은 에러가 발생하였다. 페이스북 라이브러리를 3점대로 바꾸면된다는데 이거는 안해봤고

아래와같이 social service 에 적어준다. 

@PostConstruct
private void init() {
try {
String[] fieldsToMap = {
"id", "about", "age_range", "birthday", "context", "cover",
"currency", "devices", "education", "email", "favorite_athletes",
"favorite_teams", "first_name", "gender", "hometown",
"inspirational_people", "installed", "install_type","is_verified",
"languages", "last_name", "link", "locale", "location", "meeting_for",
"middle_name", "name", "name_format","political", "quotes",
"payment_pricepoints", "relationship_status", "religion",
"security_settings", "significant_other","sports", "test_group"
, "timezone", "third_party_id", "updated_time", "verified",
"viewer_can_send_gift","website", "work"
};

Field field = Class.forName("org.springframework.social.facebook.api.UserOperations").
getDeclaredField("PROFILE_FIELDS");
field.setAccessible(true);

Field modifiers = field.getClass().getDeclaredField("modifiers");
modifiers.setAccessible(true);
modifiers.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(null, fieldsToMap);

} catch (Exception ex) {
ex.printStackTrace();
}
}

출처 : https://github.com/jhipster/generator-jhipster/issues/2349

반응형