要给API平台自定义实体属性添加获取器名称,可以按照以下步骤进行:
public class CustomEntity {
private String property;
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
}
@RestController
public class CustomEntityController {
@GetMapping("/customEntity/property")
public String getProperty() {
CustomEntity customEntity = new CustomEntity();
customEntity.setProperty("Property Value");
return customEntity.getProperty();
}
}
/customEntity/property
接口可以获取到自定义实体属性的值。这样就可以通过API平台的自定义实体属性的获取器方法获取属性的值了。