我想实现的BeanPostProcessor回到我自己的JdbcPollingChannelAdapter,这将有助于我添加一些记录和了解投票活动。 我有一些代码如下,请帮忙完成这个或是否有更好的办法。
谢谢
public class CustomAdapter extends JdbcPollingChannelAdapter {
private final static Logger logger = LoggerFactory.getLogger(CustomAdapter .class);
public CustomJdbcPollingChannelAdapter(DataSource dataSource, String selectQuery)
{
super(dataSource, selectQuery);
}
@Override
public Message<Object> receive()
{
Message<Object> polledData = super.receive();
if(polledData == null || polledData.getPayload() == null)
logger.info("received no data..............");
return polledData;
}
}
公共类MyPostProcessor实现的BeanPostProcessor {
private final static Logger logger = LoggerFactory.getLogger(MyPostProcessor .class);
public Object postProcessAfterInitialization(Object bean, String beanName)throws BeansException
{
/* not able to figure what goes here for this to work.
logger.info(bean+"..................."+beanName);
if(bean instanceof org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean)
{
//SourcePollingChannelAdapterFactoryBean bean = (SourcePollingChannelAdapterFactoryBean)bean;
//bean...??
return bean;
}
else
{
return bean;
}
*/
return bean;
}
public Object postProcessBeforeInitialization(Object bean, String beanName)throws BeansException
{
//logger.info(bean+"................................................."+beanName);
return bean;
}
}