The method names from Spring data repositories may become really long. For example:
List<InstanceConfig> findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfter(
String appId, String clusterName,
String namespaceName, Date validDate);
I am looking for any annotation that would allow me to do something like this:
@XX(key = "findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfter")
List<InstanceConfig> customMethodName(String appId, String clusterName,
String namespaceName, Date validDate);
Is there any solution to the name length problem?
With java 8 you can create a
default methodand call the method with the too length name:Then if you call
customMethodNameis as you are callingfindByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfter.