I am part of a team developing a spring boot backend application, which provides mobile applications with data. Along with a new feature the need of loading a resource at the backend, which need to be provided to the mobile application arose.
Due to the fact that this resource is important and making the access to the resource effective by loading it once during startup, i wondered if i can tell spring boot to not start without this resource existing in the file system. I know about the annotation @PostConstruct, but loading the resource there seems to be too late.
Thanks in advance for suggtestions
@PostConstruct can be used to make sure application has the stuff that you need when it starts like DB pooling etc. For example, you can throw IllegalStateException() if the file is not there and it can stop the application from loading. I ran a quick test and it works. You can use them as below.