Add new environment check

Hi

I would like to add another environment check on application startup, that will check some AppContext properties values.

It needs to be very early in application start, like current EnvironmentCheck instances provided with the platfom, like JvmCheck

The checks are ran by the AppContextLoader through the method beforeInitAppContext()

    @Override
    protected void beforeInitAppContext() {
        super.beforeInitAppContext();

        log.info("DbmsType of the main database is set to " + DbmsType.getType() + DbmsType.getVersion());

        runEnvironmentSanityChecks();
        // Init persistence.xml
        Stores.getAll().forEach(AppContextLoader::createPersistenceXml);
    }

    protected void runEnvironmentSanityChecks() {
        EnvironmentChecksRunner checks = new EnvironmentChecksRunner(getBlock());
        checks.addCheck(new JvmCheck());
        checks.addCheck(new DirectoriesCheck());
        checks.addCheck(new DataStoresCheck());
        checks.runChecks();
    }

Howcan I add a check to this list ?

Best Regards
Michael

Hi, Michael.

As I understand this question not relates with specific of Cuba Framework. Seems that you should discover Spring documentaion. For example to read about ContextLoaderListener.

Please concrete your question if I understand you not correctly.

Best wishes, Pavel.