为了账号安全,请及时绑定邮箱和手机立即绑定

Spring Boot REST:忽略排序方向,但排序通常有效

Spring Boot REST:忽略排序方向,但排序通常有效

绝地无双 2021-09-29 16:22:20
由于还没有公认的答案,我发布了我的完整解决方案,它建立在@nationquest 的答案之上:private ConfigClass loadConfiguration(String path){    MutablePropertySources sources = new MutablePropertySources();    Resource res = new FileSystemResource(path);    PropertiesFactoryBean propFactory = new PropertiesFactoryBean();    propFactory.setLocation(res);    propFactory.setSingleton(false);    // resolve potential references to local environment variables    Properties properties = null;    try {        properties = propFactory.getObject();        for(String p : properties.stringPropertyNames()){            properties.setProperty(p, env.resolvePlaceholders(properties.getProperty(p)));        }    } catch (IOException e) {        e.printStackTrace();    }    sources.addLast(new PropertiesPropertySource("prefix", properties));    ConfigurationPropertySource propertySource = new MapConfigurationPropertySource(properties);    return new Binder(propertySource).bind("prefix", ConfigClass.class).get();}最后三行是这里的相关部分。
查看完整描述

1 回答

?
蝴蝶刀刀

TA贡献1801条经验 获得超8个赞

试试这个网址。

http://localhost:8080/dimensionAttributeValues/search/findDimensionAttributeValueByDimensionAttributeDimensionAttributeID?dimensionAttributeId=1&page=0&size=1&sort=chrValue,desc.

这将按降序对您的数据进行排序。


查看完整回答
反对 回复 2021-09-29
  • 1 回答
  • 0 关注
  • 138 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信