我从spring-boot网站下载源代码演示代码,当我导入Intelj构思并启动应用程序时,控制台有一个WARN,它说
2017-08-14 12:23:23.609 WARN 2356 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : Unable to start LiveReload server
虽然应用程序正在运行,但我仍然想知道为什么它有这个警告!
在使用 JPA 接口时JpaSpecificationExecutor,我创建了以下代码,但它抛出错误:“至少提供了 2 个参数,但查询中仅存在 1 个参数”。
调用代码
@Override
public Result findSightsWithConditions(String cityId, Map<String, String> filter_map) {
//scoreOrder priceOrder minScore maxScore minPrice maxPrice
Specification<Sight> specification = new Specification<Sight>() {
@Override
public Predicate toPredicate(Root<Sight> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
List<Predicate> predicates = Lists.newArrayList();
//predicates.add(criteriaBuilder.equal(root.get("cityId"), cityId));
if (null != filter_map.get("maxScore")) {
double max = Integer.parseInt(filter_map.get("maxScore"));
predicates.add(criteriaBuilder.lessThanOrEqualTo(root.get("score"), max));
}
if (null != filter_map.get("maxPrice")) {
double max = Integer.parseInt(filter_map.get("maxPrice"));
predicates.add(criteriaBuilder.lessThanOrEqualTo(root.get("price"), max));
}
if (null != filter_map.get("minScore")) {
double min = Double.parseDouble(filter_map.get("minScore")); …Run Code Online (Sandbox Code Playgroud)