Commit 0e4dcd82 authored by yanzg's avatar yanzg

修改实例化关系

parent aa9f6cea
...@@ -13,6 +13,7 @@ import org.springframework.jdbc.core.RowCallbackHandler; ...@@ -13,6 +13,7 @@ import org.springframework.jdbc.core.RowCallbackHandler;
import org.springframework.jdbc.support.rowset.SqlRowSet; import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -30,6 +31,7 @@ public class DbExecuteImpl implements DbExecute, ApplicationContextAware { ...@@ -30,6 +31,7 @@ public class DbExecuteImpl implements DbExecute, ApplicationContextAware {
private ConfigDb configDb; private ConfigDb configDb;
@Resource
private JdbcTemplate jdbc; private JdbcTemplate jdbc;
/** /**
...@@ -50,7 +52,6 @@ public class DbExecuteImpl implements DbExecute, ApplicationContextAware { ...@@ -50,7 +52,6 @@ public class DbExecuteImpl implements DbExecute, ApplicationContextAware {
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.printSql = applicationContext.getBean(DbPrintSql.class); this.printSql = applicationContext.getBean(DbPrintSql.class);
this.configDb = applicationContext.getBean(ConfigDb.class); this.configDb = applicationContext.getBean(ConfigDb.class);
this.jdbc = applicationContext.getBean(JdbcTemplate.class);
} }
public JdbcTemplate getJdbc() { public JdbcTemplate getJdbc() {
......
...@@ -20,6 +20,7 @@ import org.springframework.context.*; ...@@ -20,6 +20,7 @@ import org.springframework.context.*;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -36,9 +37,11 @@ public class MessageServiceImpl implements MessageService, ApplicationContextAwa ...@@ -36,9 +37,11 @@ public class MessageServiceImpl implements MessageService, ApplicationContextAwa
* 用于内部自引用,调用事物 * 用于内部自引用,调用事物
*/ */
private MessageDao messageDao; private MessageDao messageDao;
private MyRabbitTemplate rabbitTemplate;
private YzgMqProcedure yzgMqProcedure; private YzgMqProcedure yzgMqProcedure;
@Resource
private MyRabbitTemplate rabbitTemplate;
/** /**
* Set the ApplicationContext that this object runs in. * Set the ApplicationContext that this object runs in.
* Normally this call will be used to initialize the object. * Normally this call will be used to initialize the object.
...@@ -56,7 +59,6 @@ public class MessageServiceImpl implements MessageService, ApplicationContextAwa ...@@ -56,7 +59,6 @@ public class MessageServiceImpl implements MessageService, ApplicationContextAwa
@Override @Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
messageDao = applicationContext.getBean(MessageDao.class); messageDao = applicationContext.getBean(MessageDao.class);
rabbitTemplate = applicationContext.getBean(MyRabbitTemplate.class);
yzgMqProcedure = applicationContext.getBean(YzgMqProcedure.class); yzgMqProcedure = applicationContext.getBean(YzgMqProcedure.class);
} }
......
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