I have a class that stores the different endpoints for an API. The class looks like the following:
public class APIEndpoints {
public static String LOG_IN = "/api/auth/login";
public static String LOG_OUT= "/api/auth/logout";
public static String GET_INSTANCE ="/api/{objectID}/instances?offset={offset}&limit{limit}";
public static String getInstance(String reportID, int offSet, int limit){
return GET_INSTANCE.replace("{reportID}",reportID)
.replace("{offset}", String.valueOf(offSet))
.replace("{limit}", String.valueOf(limit));
}
}
I would like that the endpoints URLs ("api/auth/login" for example) , are loaded from a file, like a endpoints.properties.
I'm using SpringBoot, but it does not allow to inject values on static variables.
What would be the 'most' elegant solution to solve this? How would you approach it?
Thank you.