I want to write some query methods in repository layer. This method must ignore null parameters. For example:
List findByBarAndGoo(Bar barParam,
Complementing the answer of @chaserb, I personally would add the parameter as a Java8 Optional type to make it explicit in the signature of the method the semantics that is an optional filter.
@Query("select foo from Foo foo where foo.bar = :bar and "
+ "(:goo is null or foo.goo = :goo)")
public List findByBarAndOptionalGoo(
@Param("bar") Bar bar,
@Param("goo") Optional goo);