Doesn't the repository currently wrap the registry? Hence def!=null is superfluous.