I have a service that takes in a DTO and returns some result:
@Override
public int foo(Bar bar) {
....
}
Bar is as follows (simplified):
public class Bar {
public int id;
public String name;
public String baz;
@Override
public int hashCode() {
//this is already being defined for something else
...
}
@Override
public boolean equals(Object o) {
//this is already being defined for something else
...
}
}
I want to use @Cacheable on the foo method; however, I want to hash on the id and name properties, but not baz. Is there a way to do this?