如何让spring mvc web应用启动时就执行特定处理
1个回答
2016-07-05
展开全部
一、ApplicationContextAware接口
package org.springframework.context;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.Aware;
import org.springframework.context.ApplicationContext;
public interface ApplicationContextAware extends Aware {
void setApplicationContext(ApplicationContext var1) throws BeansException;
}
二、ServletContextAware 接口
package org.springframework.web.context;
import javax.servlet.ServletContext;
import org.springframework.beans.factory.Aware;
public interface ServletContextAware extends Aware {
void setServletContext(ServletContext var1);
}
三、InitializingBean 接口
package org.springframework.beans.factory;
public interface InitializingBean {
void afterPropertiesSet() throws Exception;
}
四、ApplicationListener<ApplicationEvent> 接口
package org.springframework.context;
import java.util.EventListener;
import org.springframework.context.ApplicationEvent;
public interface ApplicationListener<E extends ApplicationEvent> extends EventListener {
void onApplicationEvent(E var1);
}
package org.springframework.context;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.Aware;
import org.springframework.context.ApplicationContext;
public interface ApplicationContextAware extends Aware {
void setApplicationContext(ApplicationContext var1) throws BeansException;
}
二、ServletContextAware 接口
package org.springframework.web.context;
import javax.servlet.ServletContext;
import org.springframework.beans.factory.Aware;
public interface ServletContextAware extends Aware {
void setServletContext(ServletContext var1);
}
三、InitializingBean 接口
package org.springframework.beans.factory;
public interface InitializingBean {
void afterPropertiesSet() throws Exception;
}
四、ApplicationListener<ApplicationEvent> 接口
package org.springframework.context;
import java.util.EventListener;
import org.springframework.context.ApplicationEvent;
public interface ApplicationListener<E extends ApplicationEvent> extends EventListener {
void onApplicationEvent(E var1);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询