Commit 29d344d0 authored by yanzg's avatar yanzg

修改实例化关系

parent 4c4d285f
......@@ -3,21 +3,41 @@ package com.yanzuoguang.db.impl;
import com.yanzuoguang.db.ConfigDb;
import com.yanzuoguang.util.helper.StringHelper;
import com.yanzuoguang.util.log.Log;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.*;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 打印SQL语句日志工具类
*
* @author 颜佐光
*/
@Component
public class DbPrintSql {
public class DbPrintSql implements ApplicationContextAware {
@Resource
private ConfigDb configDb;
/**
* Set the ApplicationContext that this object runs in.
* Normally this call will be used to initialize the object.
* <p>Invoked after population of normal bean properties but before an init callback such
* as {@link InitializingBean#afterPropertiesSet()}
* or a custom init-method. Invoked after {@link ResourceLoaderAware#setResourceLoader},
* {@link ApplicationEventPublisherAware#setApplicationEventPublisher} and
* {@link MessageSourceAware}, if applicable.
*
* @param applicationContext the ApplicationContext object to be used by this object
* @throws ApplicationContextException in case of context initialization errors
* @throws BeansException if thrown by application context methods
* @see BeanInitializationException
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.configDb = applicationContext.getBean(ConfigDb.class);
}
/**
* 获取参数处理之后的SQL语句
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment