我想限制某些查询的结果
application.properties
...
spring.neo4j.resultlimit=10
...
PersonRepository
public interface PersonRepository extends GraphRepository<Person> {
@Query("MATCH p=()-->() RETURN nodes(p) as n, relationships(p)[0] as e") //<--how can I access spring.neo4j.resultlimit value and limits this query?
Iterable<Map<String, String>> graph();
}
答案 0 :(得分:0)
您的Spring客户端可以获得spring.neo4j.resultlimit
的值并将其传递给graph()
方法,可以这样定义:
public interface PersonRepository extends GraphRepository<Person> {
@Query("MATCH p=()-->() RETURN nodes(p) as n, relationships(p)[0] as e LIMIT {0}")
Iterable<Map<String, String>> graph(Integer resultLimit);
}