download:Jian refers to Java from the framework, win Spring source code

Whether it is learning the source code of the Spring framework, or the framework design, the threshold for entry is too high to understand obscure. This course aims to grasp these two pain points and make people gradually familiar with the context of Spring framework in the interspersed explanation of self-research framework and Spring framework. By building a relatively complete Web framework from 0 to improve my framework design ability, and at the same time, I can get a glimpse of the design ideas of Spring framework, supplemented by easy-to-understand Spring core module source code explanation, lowering the threshold of the course. After learning this course, we can learn to read the source code of Spring and other frameworks by ourselves.

Suitable for people 1. College students 2. Working Java programmers technical reserve requirements 1. 2. Familiar with the basic knowledge of Spring

public class ObjectIdConverter : JsonConverter { public override bool CanConvert(Type objectType) { return objectType == typeof(ObjectId); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.TokenType ! = JsonToken.String) { throw new Exception( String.Format(“Unexpected token parsing ObjectId. Expected String, got {0}.”, reader.TokenType)); } var value = (string)reader.Value; return String.IsNullOrEmpty(value) ? ObjectId.Empty : new ObjectId(value); } public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { if (value is ObjectId) { var objectId = (ObjectId)value; writer.WriteValue(objectId ! = ObjectId.Empty ? objectId.ToString() : String.Empty); } else { throw new Exception(“Expected ObjectId value.”); Add a line of code to the ObjectId field

[JsonConverter(typeof(ObjectIdConverter))] public string _id { get; set; } If Newtonsoft’s JsonConvert is used, additional parameters are required

JsonConvert.DeserializeObject(json,new ObjectIdConverter());

3, after Ignore, a very skillful writing method

[JsonIgnore] public override ObjectId _Id { get; set; } [BsonIgnore] public string _IdStr { get { return Id.ToString(); } set { ObjectId id; ObjectId.TryParse(value, out id); Id = id; }}