spring在項目啓動時就執行特定方法

如何在項目啓動時就執行特定方法 1. 方法上加註解@PostConstruct @Compant public class InitDemo{ @PostConstruct public void init(){ //項目啓動就會執行這個方法 doSomething(); } } 2.xml配置init-method <bean id="I
相關文章
相關標籤/搜索