<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->

- [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.

## Describe the proposal
<!-- Please use this for a concrete design proposal for functionality. -->
<!-- If you just want to request a new feature and discuss the possible business value, create a Feature Request. -->

Mark Dubbo Module if is spring managed. Wait spring to close module before execure dubbo shutdown hook.

frameworkModel.destroy();
    }
    @Test
    public void testModelEnvironment() {
        FrameworkModel frameworkModel = new FrameworkModel();
        ApplicationModel applicationModel = new ApplicationModel(frameworkModel);
        ModuleModel moduleModel = new ModuleModel(applicationModel);
        ModuleEnvironment modelEnvironment = moduleModel.getModelEnvironment();
        Assertions.assertNotNull(modelEnvironment);
        frameworkModel.destroy();
    }
    @Test
    public void testDestroy() {
        FrameworkModel frameworkModel = new FrameworkModel();
        ApplicationModel applicationModel = new ApplicationModel(frameworkModel);
        ModuleModel moduleModel = new ModuleModel(applicationModel);
        MockScopeModelDestroyListener destroyListener = new MockScopeModelDestroyListener();
        moduleModel.addDestroyListener(destroyListener);
        moduleModel.destroy();
        Assertions.assertTrue(destroyListener.isDestroyed());
        Assertions.assertEquals(destroyListener.getScopeModel(), moduleModel);
        Assertions.assertFalse(applicationModel.getPubModuleModels().contains(moduleModel));
        Assertions.assertNull(moduleModel.getServiceRepository());
        Assertions.assertTrue(moduleModel.isDestroyed());
        
        Assertions.assertTrue(applicationModel.isDestroyed());
        Assertions.assertTrue(frameworkModel.isDestroyed());
    }
}