0
我有以下集「播放器」傑克遜,哈希密碼不被映射
{
"_id" : ObjectId("5426efb844ae829d1dcdaa6d"),
"username" : "Foobar",
"password" : "0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33",
"gameIds" : [
"5426f10544ae8502f731d8a0"
]
}
它有一個哈希密碼。 當我嘗試映射到我的Player對象時,除密碼之外的所有內容都被映射。密碼爲空。
這是我的播放器映射
@Data
@JsonRootName("player")
@NoArgsConstructor
public class Player {
@JsonIgnore
public static final String COL_NAME = "player";
@ObjectId
@Id
private String id;
/**Will use this token to authorize the user. This UUID should be cached once the user logs in */
@JsonIgnore
private UUID token = UUID.randomUUID();
@NotBlank
//Unique
private String username;
@Email
private String email;
@NotBlank
private String password;
/** Set of unique active games * */
private Set<String> gameIds = new HashSet<>();
}
我節省了玩家這樣的:
Player player = new Player();
player.setUsername(username);
player.getGameIds().add(pbfId);
player.setPassword(DigestUtils.sha1Hex("foo"));
playerCollection.insert(player);
而且讀這樣的:
DBCursor<Player> username = playerCollection.find(DBQuery.is("username", "Foobar"), new BasicDBObject());
Player player = username.next();
這一切,除了密碼正確映射
Jackson在哪裏介入? – 2014-09-27 17:33:00
Mongojack在內部使用它 – 2014-09-27 17:59:32