⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 personconvertertest.java

📁 《精通Spring》源代码
💻 JAVA
字号:
/*
 * Created on 2004-11-9
 *
 * http://www.open-v.com 提供代码的维护工作
 */
package com.openv.spring;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jms.core.JmsTemplate;

/**
 * PersonConverterTest客户应用
 * 
 * @author luoshifei
 */
public class PersonConverterTest {
    protected static final Log log = LogFactory
            .getLog(PersonConverterTest.class);

    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext(
                "personconvertertest.xml");

        JmsTemplate jt = (JmsTemplate) ac.getBean("jmsTemplate");
        
        PersonVO personSend = new PersonVO();
        personSend.setFirstname("Shifei");
        personSend.setLastname("Luo");

        //转换并发送消息
        jt.convertAndSend(personSend);
        log.info("成功发送消息!");
        
        //接收并转换消息
        PersonVO personReceive = (PersonVO) jt.receiveAndConvert();
        log.info(personReceive.getFirstname() + ", " + personReceive.getLastname());
        log.info("成功接收消息!");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -