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
Post a Comment