I am currently using @RestResource(exported = false)
on all delete operations in a repository to hide delete requests. This is done explicitly in repositories extending JPA repository.
Is there a global switch to block all delete operations?
I am currently using @RestResource(exported = false)
on all delete operations in a repository to hide delete requests. This is done explicitly in repositories extending JPA repository.
Is there a global switch to block all delete operations?
No. You need to annotate all your delete operations with @RestResource(exported = false)
.
Example from Spring data doc:
@RepositoryRestResource(path = "people", rel = "people")
interface PersonRepository extends CrudRepository<Person, Long> {
@Override
@RestResource(exported = false)
void delete(Long id);
@Override
@RestResource(exported = false)
void delete(Person entity);
}
Explanation below:
If you want turn them off, then just keep in mind you have to annotate both versions with exported = false.
So by default, if there is not new you need to annotate all your operations. But if you are very interested at the moment you could perform your own annotation with a implementation which does it.
As of 2018, there is now the ability to only expose repository methods explicitly declared for exposure