DATACMNS-374 - Improved error handling in case of a missing repository.
In Repositories.getCrudInvoker(…) we now throw an IllegalArgumentException if we cannot find an appropriate repository for the given domain class. Previously it just blew up with a NullPointerException without a clear error message. Original pull request: #46.
This commit is contained in:
committed by
Oliver Gierke
parent
43b7a54294
commit
2d699b6b36
@@ -163,6 +163,8 @@ public class Repositories implements Iterable<Class<?>> {
|
||||
RepositoryInformation information = getRepositoryInformationFor(domainClass);
|
||||
Object repository = getRepositoryFor(domainClass);
|
||||
|
||||
Assert.notNull(repository, String.format("No repository found for domain class: %s", domainClass));
|
||||
|
||||
if (repository instanceof CrudRepository) {
|
||||
return new CrudRepositoryInvoker<T>((CrudRepository<T, Serializable>) repository);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user