When you persist an entity using spring-data then mongo document created will have an _class attribute which stores the fully qualified name of the class. The @TypeAlias is to customize the value saved in the _class attribute.
This example from the spring reference shows how the _class attribute is added to the mongo document. If you attach a @TypeAlias("sample) then the _class attribute will have the value "sample" instead of the fully qualified name.
public class Sample {
Contact value;
}
public abstract class Contact { … }
public class Person extends Contact { … }
Sample sample = new Sample();
sample.value = new Person();
mongoTemplate.save(sample);
{ "_class" : "com.acme.Sample",
"value" : { "_class" : "com.acme.Person" }
}