I using spring boot and I have an Entity that store path of a URL and because of domain address could be changed in the future, I didn't store full URL into the database. Here is my entity:
@Entity
public class TestModel
{
private String urlPath;
@Transient
private String fullUrl;
//getters and setters...
}
I need to concat domain address with urlPath
and store its value into fullUrl
field during serialization model.
I know I can do this in getter method of the fullUrl
field, But domain address should be read from the configuration and model should not have anything about the business logic.
what is the best practice to implement it?