@Override
    public final Optional<ConfigDefinition> getConfigDefinition(ConfigDefinitionKey defKey) {
        if (configDefinitionSuppliers == null) {
            configDefinitionSuppliers = new LinkedHashMap<>();
            configDefinitionRepo.ifPresent(definitionRepo -> configDefinitionSuppliers.putAll(createLazyMapping(definitionRepo)));
            configDefinitionSuppliers.putAll(applicationPackage.getAllExistingConfigDefs());
        }
        if ( ! configDefinitionSuppliers.containsKey(defKey)) return Optional.empty();

        if (configDefinitionCache.get(defKey) != null)
            return Optional.of(configDefinitionCache.get(defKey));

        ConfigDefinition def = configDefinitionSuppliers.get(defKey).parse();

        configDefinitionCache.put(defKey, def);
        return Optional.of(def);
    }
@Test
    void testDefinitionRepoIsUsed() {
        Map<ConfigDefinitionKey, com.yahoo.vespa.config.buildergen.ConfigDefinition> defs = new LinkedHashMap<>();
        defs.put(new ConfigDefinitionKey("foo", "bar"), new com.yahoo.vespa.config.buildergen.ConfigDefinition("foo", new String[]{"namespace=bar", "foo int default=0"}));
        defs.put(new ConfigDefinitionKey("test2", "a.b"),
                new com.yahoo.vespa.config.buildergen.ConfigDefinition("namespace-in-filename", new String[]{"namespace=a.b", "doubleVal double default=1.0"}));
        ApplicationPackage app = FilesApplicationPackage.fromFile(new File("src/test/cfg//application/app1"));
        DeployState state = createDeployState(app, defs);

        assertNotNull(state.getConfigDefinition(new ConfigDefinitionKey("foo", "bar")));
        ConfigDefinition overridden = state.getConfigDefinition(new ConfigDefinitionKey("namespace-in-filename", "a.b")).get();
        assertNotNull(overridden);
        Double defaultValue = overridden.getDoubleDefs().get("doubleVal").getDefVal();
        assertNotNull(defaultValue);
        assertEquals(0, defaultValue.intValue());
    }