java - Can spring boot be told to start an application only if a resource is available? -


i part of team developing spring boot backend application, provides mobile applications data. along new feature need of loading resource @ backend, need provided mobile application arose.

due fact resource important , making access resource effective loading once during startup, wondered if can tell spring boot not start without resource existing in file system. know annotation @postconstruct, loading resource there seems late.

thanks in advance suggtestions

@postconstruct can used make sure application has stuff need when starts db pooling etc. example, can throw illegalstateexception() if file not there , can stop application loading. ran quick test , works. can use them below.

@postconstruct     public void setup() {         // check stuff need.         if (condition) {                             throw new illegalstateexception();         }     } 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -