精华内容
下载资源
问答
  • 与动态映射框架相比,MapStruct具有以下优点: 1,使用纯Java方法代替Java反射机制快速执行 2,编译时类型安全:只能映射彼此的对象和属性,不能映射一个Order实体到一个Customer DTO中等等 3,如果无法映射实体或...

    什么是MapStruct?

    MapStruct是用于生成类型安全的bean映射类的Java注解处理器。

    你所要做的就是定义一个映射器接口,声明任何需要映射的方法。在编译过程中,MapStruct将生成该接口的实现。此实现使用纯Java的方法调用源对象和目标对象之间进行映射,并非Java反射机制。

    与手工编写映射代码相比,MapStruct通过生成冗长且容易出错的代码来节省时间。在配置方法的约定之后,MapStruct使用了合理的默认值,但在配置或实现特殊行为时将不再适用。

    与动态映射框架相比,MapStruct具有以下优点:

    1,使用纯Java方法代替Java反射机制快速执行
    2,编译时类型安全:只能映射彼此的对象和属性,不能映射一个Order实体到一个Customer DTO中等等
    3,如果无法映射实体或属性,则在编译时清除错误报告

    maven依赖导入

    <dependency>
                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct</artifactId>
                <version>1.3.1.Final</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct-processor</artifactId>
                <version>1.3.1.Final</version>
                <scope>compile</scope>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.5.1</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    

    直接上代码

    首先定义一个泛型的基础映射器BaseMapping

    /**
     * <p>
     * MapStruct映射基类,直接继承接口即可使用通用方法,针对性指定需在继承类的接口方法上指定
     *
     * 例: public interface xxxMapping extends BaseMapping<xxxDO, xxxDTO>
     *
     * 具体用法可参考单元测试,建议配合MapStruct Support插件使用
     */
    @MapperConfig(componentModel = "spring")
    public interface BaseMapping<S, T> {
    
        /** 正向映射 */
        @InheritConfiguration
        T convertTo(S obj);
    
        /** 反向映射 */
        @InheritInverseConfiguration(name = "convertTo")
        S convertFrom(T obj);
    
        /** 正向映射(List) */
        default List<T> convertTo(List<S> list) {
            if (list == null) {
                return null;
            }
    
            List<T> result = new ArrayList<T>(list.size());
            for (S s : list) {
                if (s == null) {
                    continue;
                }
                result.add(convertTo(s));
            }
    
            return result;
        }
    
        /** 反向映射(List) */
        default List<S> convertFrom(List<T> list) {
            if (list == null) {
                return null;
            }
    
            List<S> result = new ArrayList<S>(list.size());
            for (T t : list) {
                if (t == null) {
                    continue;
                }
                result.add(convertFrom(t));
            }
    
            return result;
        }
    
        /** 正向映射的后置处理,List映射会自动继承此配置 */
        @AfterMapping
        default void handleAfterConvertTo(S src, @MappingTarget T dest) {
            afterConvertTo(src, dest);
        }
    
        /** 反向映射的后置处理,List映射会自动继承此配置 */
        @AfterMapping
        default void handleAfterConvertFrom(T src, @MappingTarget S dest) {
            afterConvertFrom(src, dest);
        }
    
        /** 正向映射的后置处理,List映射会自动继承此配置 */
        default void afterConvertTo(S src, T dest) {
            //TODO 覆盖此方法处理其他复杂转换逻辑
        }
    
        /** 反向映射的后置处理,List映射会自动继承此配置 */
        default void afterConvertFrom(T src, S dest) {
            //TODO 覆盖此方法处理其他复杂转换逻辑
        }
    
    //    /** 正向映射(stream) */
    //    @InheritConfiguration(name = "convertTo")
    //    Stream<T> convertTo(Stream<S> stream);
    //
    //    /** 反向映射(stream) */
    //    @InheritConfiguration(name = "convertFrom")
    //    Stream<S> convertFrom(Stream<T> stream);
    }
    

    @MapperConfig:定义一个映射器配置
    @InheritConfiguration:正向映射自动继承转换类型相同属性名相同的字段
    @InheritInverseConfiguration:反向映射自动继承转换类型相同属性名相同的字段
    @AfterMapping:后置处理器,在自动转换后可以实现不同类型不同字段之间的自定义转换

    实现具体的类型转换器

    这里实现一个具体的DO—>DTO的类型转换器EditionMapping

    /**
     * @author shihaowei
     * @date 2020/6/30 4:34 下午
     */
    @Mapper(componentModel = "spring")
    public interface EditionMapping extends BaseMapping<EditionDO, EditionDTO> {
    
        EditionMapping INSTANT = Mappers.getMapper(EditionMapping.class);
    
        @Override
        default void afterConvertTo(EditionDO src, EditionDTO dest) {
            dest.setOrderArray(src.getOrderarray());
            dest.setOrderList(src.getOrderlist());
        }
    }
    

    用于测试的两个实体类:
    EditionDO

    public class EditionDO {
    
        private Integer id;
        private String name;
        private Double memory;
        private String orderarray;
        private String orderlist;
    
        public Integer getId() {
            return id;
        }
    
        public void setId(Integer id) {
            this.id = id;
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public Double getMemory() {
            return memory;
        }
    
        public void setMemory(Double memory) {
            this.memory = memory;
        }
    
        public String getOrderarray() {
            return orderarray;
        }
    
        public void setOrderarray(String orderarray) {
            this.orderarray = orderarray;
        }
    
        public String getOrderlist() {
            return orderlist;
        }
    
        public void setOrderlist(String orderlist) {
            this.orderlist = orderlist;
        }
    
        @Override
        public String toString() {
            return "EditionDO{" +
                    "id=" + id +
                    ", name='" + name + '\'' +
                    ", memory=" + memory +
                    ", orderarray='" + orderarray + '\'' +
                    ", orderlist='" + orderlist + '\'' +
                    '}';
        }
    }
    
    

    EditionDTO

    /**
     * @author shihaowei
     * @date 2020-06-10 16:35
     */
    public class EditionDTO {
    
        private Integer id;
        private String name;
        private String memory;
        private String orderArray;
        private String orderList;
    
        public Integer getId() {
            return id;
        }
    
        public void setId(Integer id) {
            this.id = id;
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public String getMemory() {
            return memory;
        }
    
        public void setMemory(String memory) {
            this.memory = memory;
        }
    
        public String getOrderArray() {
            return orderArray;
        }
    
        public void setOrderArray(String orderArray) {
            this.orderArray = orderArray;
        }
    
        public String getOrderList() {
            return orderList;
        }
    
        public void setOrderList(String orderList) {
            this.orderList = orderList;
        }
    
        @Override
        public String toString() {
            return "EditionDTO{" +
                    "id=" + id +
                    ", name='" + name + '\'' +
                    ", memory=" + memory +
                    ", orderArray='" + orderArray + '\'' +
                    ", orderList='" + orderList + '\'' +
                    '}';
        }
    }
    
    

    这里这两个类有两个字段名不同,需要在后置处理器里面去手动转换,只有类型相同属性名相同的属性才会自动转换,测试如下:
    在这里插入图片描述
    这里不同属性名转换成功。

    如果相同属性名,但是类型不同的话,转换会出现什么问题呢?然后我把EditionDTO里面memory属性的类型改成Date,而源EditionDO里面memory属性的类型是Double,然后我们进行测试:

      @Test
        public void getEditionById2(){
            EditionDO editionDO = testService.getEditionById(1);
            System.err.println(editionDO);
            EditionDTO editionDTO = editionMapping.convertTo(editionDO);
            System.err.println(editionDTO);
        }
    

    在这里插入图片描述
    这里的解决方法就是自定义转换类型并切去接口继承
    DoubleToDateMapping

    /**
     * @author shihaowei
     * @date 2020/7/1 1:55 下午
     */
    public interface DoubleToDateMapping {
    
        default Date DoubleToDate(Double memory){
            return new Date();
        }
    }
    

    然后在mapping转化器里面去继承这个接口,然后可以自动把Double类型转换成Date

    @Mapper(componentModel = "spring")
    public interface EditionMapping extends BaseMapping<EditionDO, EditionDTO>, DoubleToDateMapping {
    
        EditionMapping INSTANT = Mappers.getMapper(EditionMapping.class);
    
        @Override
        default void afterConvertTo(EditionDO src, EditionDTO dest) {
            dest.setOrderArray(src.getOrderarray());
            dest.setOrderList(src.getOrderlist());
        }
    }
    
    

    然后我们再次运行测试:
    在这里插入图片描述
    这里显示转换成功了,这里使用Double转Date的例子不太合情理,但是达到的目的就是不同类型的转换

    注:针对相同属性字段不同类型的属性转换为String,正对常用的包装类型mapstruct封装李对这些常用类型的转换,不需要自己写转换

    展开全文
  • 使用--prod标志进行生产构建。 运行单元测试 运行ng test通过执行单元测试。 运行端到端测试 运行ng e2e以通过执行端到端测试。 进一步的帮助 要获得有关Angular CLI的更多帮助,请使用ng help或查看“ 页面。
  • 使用--prod标志进行生产构建。 运行单元测试 运行ng test以通过执行单元测试。 运行端到端测试 运行ng e2e通过执行端到端测试。 进一步的帮助 要获得有关Angular CLI的更多帮助,请使用ng help或查看“ 页面。
  • 进行了使用白杨小球藻(Chrysophyllumlumbidum),未充分利用的本地果皮和具有遗传特征的黑曲霉菌株的柠檬酸生产。 干燥金银花果皮,过筛以除去污垢,干燥研磨,并将该粉末用作柠檬酸生产的底物。 通过铺板技术从...
  • package com.cjw.concurrent.scxf.lock; import com.cjw.dto.goods.GoodsDto; import lombok.extern.slf4j.Slf4j; import java.util.Date; import ja...
    package com.cjw.concurrent.scxf.lock;
    
    import com.cjw.dto.goods.GoodsDto;
    import lombok.extern.slf4j.Slf4j;
    
    import java.util.Date;
    import java.util.concurrent.LinkedBlockingQueue;
    import java.util.concurrent.locks.Condition;
    import java.util.concurrent.locks.Lock;
    import java.util.concurrent.locks.ReentrantLock;
    
    /**
     * @author wucj
     * @date 2019-06-27 17:48
     **/
    @Slf4j
    public class GoodsLockService {
        int maxDeque = 5;
        private LinkedBlockingQueue storeLinkedBlockingQueue = new LinkedBlockingQueue();
    
        private Lock lock = new ReentrantLock();
        private Condition fullCondition = lock.newCondition();
        private Condition emptyCondition = lock.newCondition();
    
        public GoodsLockService(LinkedBlockingQueue storeLinkedBlockingQueue) {
            this.storeLinkedBlockingQueue = storeLinkedBlockingQueue;
        }
    
        public void producer(Long id){
            lock.lock();
            try{
                if(storeLinkedBlockingQueue.size()>=maxDeque){
                    fullCondition.await();
                }
                emptyCondition.signalAll();
                GoodsDto dto = new GoodsDto();
                dto.setId(id);
                dto.setGoodsName("商品:"+id);
                dto.setCreateTime(new Date());
                log.info("生成产品:{}",dto.toString());
                storeLinkedBlockingQueue.add(dto);
            }catch (Exception e){
                log.error("消费产品异常:{}",e);
            }finally {
                lock.unlock();
            }
        }
    
        public void consumer(){
            int zero = 0;
            lock.lock();
            try{
                if(storeLinkedBlockingQueue.size()<=zero){
                    emptyCondition.await();
                }
                fullCondition.signalAll();
                GoodsDto dto = (GoodsDto) storeLinkedBlockingQueue.take();
                log.info("消费产品:{}",dto.toString());
            }catch (Exception e){
                log.error("消费产品异常:{}",e);
            }finally {
                lock.unlock();
            }
        }
    
    }
    
    package com.cjw.concurrent.scxf.lock;
    
    import lombok.extern.slf4j.Slf4j;
    
    /**
     * @author wucj
     * @date 2019-06-27 17:45
     **/
    @Slf4j
    public class ProducerLock implements Runnable{
    
        private GoodsLockService goodsLockService;
    
        public ProducerLock(GoodsLockService goodsLockService) {
            this.goodsLockService = goodsLockService;
        }
    
    
        @Override
        public void run() {
            int maxCount = 10;
            for(int i=0;i<maxCount;i++){
                goodsLockService.producer(Long.valueOf(i));
            }
        }
    }
    
    package com.cjw.concurrent.scxf.lock;
    
    import lombok.extern.slf4j.Slf4j;
    
    /**
     * @author wucj
     * @date 2019-06-27 17:47
     **/
    @Slf4j
    public class ConsumerLock implements Runnable{
    
        private GoodsLockService goodsLockService;
    
        public ConsumerLock(GoodsLockService goodsLockService) {
            this.goodsLockService = goodsLockService;
        }
    
    
        @Override
        public void run() {
            while (true){
                goodsLockService.consumer();
            }
        }
    }
    
    /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:62540,suspend=y,server=n -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/Users/wugong/Library/Caches/IntelliJIdea2018.1/captureAgent/debugger-agent.jar=file:/private/var/folders/rw/tc7h1gf55y74qj1k668lr1n00000gn/T/capture.props -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit-rt.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/junit/lib/junit5-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/lib/tools.jar:/Users/wugong/mine/project/demo-boot-parent/demo-boot-provider/target/test-classes:/Users/wugong/mine/project/demo-boot-parent/demo-boot-provider/target/classes:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter/2.1.2.RELEASE/spring-boot-starter-2.1.2.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot/2.1.5.RELEASE/spring-boot-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.5.RELEASE/spring-boot-autoconfigure-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-logging/2.1.5.RELEASE/spring-boot-starter-logging-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/wugong/mryx/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/wugong/mryx/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.2/log4j-to-slf4j-2.11.2.jar:/Users/wugong/mryx/repository/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar:/Users/wugong/mryx/repository/org/slf4j/jul-to-slf4j/1.7.26/jul-to-slf4j-1.7.26.jar:/Users/wugong/mryx/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/wugong/mryx/repository/org/springframework/spring-core/5.1.7.RELEASE/spring-core-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-jcl/5.1.7.RELEASE/spring-jcl-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-web/2.1.2.RELEASE/spring-boot-starter-web-2.1.2.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-json/2.1.5.RELEASE/spring-boot-starter-json-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.8/jackson-datatype-jdk8-2.9.8.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.8/jackson-datatype-jsr310-2.9.8.jar:/Users/wugong/mryx/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.8/jackson-module-parameter-names-2.9.8.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.5.RELEASE/spring-boot-starter-tomcat-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.19/tomcat-embed-core-9.0.19.jar:/Users/wugong/mryx/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.19/tomcat-embed-el-9.0.19.jar:/Users/wugong/mryx/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.19/tomcat-embed-websocket-9.0.19.jar:/Users/wugong/mryx/repository/org/hibernate/validator/hibernate-validator/6.0.16.Final/hibernate-validator-6.0.16.Final.jar:/Users/wugong/mryx/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/Users/wugong/mryx/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/Users/wugong/mryx/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar:/Users/wugong/mryx/repository/org/springframework/spring-web/5.1.7.RELEASE/spring-web-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-beans/5.1.7.RELEASE/spring-beans-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-webmvc/5.1.7.RELEASE/spring-webmvc-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-aop/5.1.7.RELEASE/spring-aop-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-expression/5.1.7.RELEASE/spring-expression-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-test/2.1.2.RELEASE/spring-boot-starter-test-2.1.2.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-test/2.1.5.RELEASE/spring-boot-test-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-test-autoconfigure/2.1.5.RELEASE/spring-boot-test-autoconfigure-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/com/jayway/jsonpath/json-path/2.4.0/json-path-2.4.0.jar:/Users/wugong/mryx/repository/net/minidev/json-smart/2.3/json-smart-2.3.jar:/Users/wugong/mryx/repository/net/minidev/accessors-smart/1.2/accessors-smart-1.2.jar:/Users/wugong/mryx/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar:/Users/wugong/mryx/repository/junit/junit/4.12/junit-4.12.jar:/Users/wugong/mryx/repository/org/assertj/assertj-core/3.11.1/assertj-core-3.11.1.jar:/Users/wugong/mryx/repository/org/mockito/mockito-core/2.23.4/mockito-core-2.23.4.jar:/Users/wugong/mryx/repository/net/bytebuddy/byte-buddy/1.9.12/byte-buddy-1.9.12.jar:/Users/wugong/mryx/repository/net/bytebuddy/byte-buddy-agent/1.9.12/byte-buddy-agent-1.9.12.jar:/Users/wugong/mryx/repository/org/objenesis/objenesis/2.6/objenesis-2.6.jar:/Users/wugong/mryx/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/wugong/mryx/repository/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar:/Users/wugong/mryx/repository/org/skyscreamer/jsonassert/1.5.0/jsonassert-1.5.0.jar:/Users/wugong/mryx/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar:/Users/wugong/mryx/repository/org/springframework/spring-test/5.1.7.RELEASE/spring-test-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/xmlunit/xmlunit-core/2.6.2/xmlunit-core-2.6.2.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-starter-jdbc/2.1.5.RELEASE/spring-boot-starter-jdbc-2.1.5.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-jdbc/5.1.7.RELEASE/spring-jdbc-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/springframework/spring-tx/5.1.7.RELEASE/spring-tx-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar:/Users/wugong/mryx/repository/org/mybatis/spring/boot/mybatis-spring-boot-starter/1.3.2/mybatis-spring-boot-starter-1.3.2.jar:/Users/wugong/mryx/repository/org/mybatis/spring/boot/mybatis-spring-boot-autoconfigure/1.3.2/mybatis-spring-boot-autoconfigure-1.3.2.jar:/Users/wugong/mryx/repository/org/mybatis/mybatis/3.4.6/mybatis-3.4.6.jar:/Users/wugong/mryx/repository/org/mybatis/mybatis-spring/1.3.2/mybatis-spring-1.3.2.jar:/Users/wugong/mryx/repository/com/zaxxer/HikariCP/3.2.0/HikariCP-3.2.0.jar:/Users/wugong/mryx/repository/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar:/Users/wugong/mryx/repository/com/alibaba/druid-spring-boot-starter/1.1.9/druid-spring-boot-starter-1.1.9.jar:/Users/wugong/mryx/repository/com/alibaba/druid/1.1.9/druid-1.1.9.jar:/Users/wugong/mryx/repository/com/github/pagehelper/pagehelper/5.0.4/pagehelper-5.0.4.jar:/Users/wugong/mryx/repository/com/github/jsqlparser/jsqlparser/1.0/jsqlparser-1.0.jar:/Users/wugong/mryx/repository/org/projectlombok/lombok/1.18.2/lombok-1.18.2.jar:/Users/wugong/mryx/repository/org/apache/dubbo/dubbo/2.7.1-SNAPSHOT/dubbo-2.7.1-20190318.092944-5.jar:/Users/wugong/mryx/repository/org/springframework/spring-context/5.1.7.RELEASE/spring-context-5.1.7.RELEASE.jar:/Users/wugong/mryx/repository/org/javassist/javassist/3.20.0-GA/javassist-3.20.0-GA.jar:/Users/wugong/mryx/repository/io/netty/netty-all/4.1.36.Final/netty-all-4.1.36.Final.jar:/Users/wugong/mryx/repository/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar:/Users/wugong/mryx/repository/org/apache/zookeeper/zookeeper/3.4.10/zookeeper-3.4.10.jar:/Users/wugong/mryx/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar:/Users/wugong/mryx/repository/jline/jline/0.9.94/jline-0.9.94.jar:/Users/wugong/mryx/repository/io/netty/netty/3.10.5.Final/netty-3.10.5.Final.jar:/Users/wugong/mryx/repository/com/github/sgroschupf/zkclient/0.1/zkclient-0.1.jar:/Users/wugong/mryx/repository/org/apache/curator/curator-recipes/4.0.1/curator-recipes-4.0.1.jar:/Users/wugong/mryx/repository/org/apache/curator/curator-framework/4.0.1/curator-framework-4.0.1.jar:/Users/wugong/mryx/repository/org/apache/curator/curator-client/4.0.1/curator-client-4.0.1.jar:/Users/wugong/mine/project/demo-boot-parent/demo-boot-service/target/classes:/Users/wugong/mine/project/demo-boot-parent/demo-boot-entity/target/classes:/Users/wugong/mine/project/demo-boot-parent/demo-boot-api/target/classes:/Users/wugong/mine/project/demo-boot-parent/demo-boot-common/target/classes:/Users/wugong/mryx/repository/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar:/Users/wugong/mryx/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/wugong/mryx/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/Users/wugong/mryx/repository/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar:/Users/wugong/mryx/repository/org/apache/httpcomponents/httpcore/4.4.11/httpcore-4.4.11.jar:/Users/wugong/mryx/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar:/Users/wugong/mryx/repository/com/google/guava/guava/18.0/guava-18.0.jar:/Users/wugong/mryx/repository/org/jsoup/jsoup/1.11.3/jsoup-1.11.3.jar:/Users/wugong/mryx/repository/org/apache/rocketmq/rocketmq-client/4.5.1/rocketmq-client-4.5.1.jar:/Users/wugong/mryx/repository/org/apache/rocketmq/rocketmq-common/4.5.1/rocketmq-common-4.5.1.jar:/Users/wugong/mryx/repository/org/apache/rocketmq/rocketmq-remoting/4.5.1/rocketmq-remoting-4.5.1.jar:/Users/wugong/mryx/repository/com/alibaba/fastjson/1.2.51/fastjson-1.2.51.jar:/Users/wugong/mryx/repository/org/apache/rocketmq/rocketmq-logging/4.5.1/rocketmq-logging-4.5.1.jar:/Users/wugong/mryx/repository/io/netty/netty-tcnative-boringssl-static/2.0.25.Final/netty-tcnative-boringssl-static-2.0.25.Final.jar:/Users/wugong/mryx/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar:/Users/wugong/mryx/repository/org/springframework/boot/spring-boot-configuration-processor/2.1.2.RELEASE/spring-boot-configuration-processor-2.1.2.RELEASE.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.cjw.concurrent.BlockingQueueTest,blockQueueLockTest
    Connected to the target VM, address: '127.0.0.1:62540', transport: 'socket'
    21:44:26.432 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=0, goodsName=商品:0, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.436 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=1, goodsName=商品:1, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.436 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=2, goodsName=商品:2, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=3, goodsName=商品:3, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=4, goodsName=商品:4, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=0, goodsName=商品:0, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=1, goodsName=商品:1, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=2, goodsName=商品:2, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=3, goodsName=商品:3, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=4, goodsName=商品:4, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=5, goodsName=商品:5, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=6, goodsName=商品:6, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=7, goodsName=商品:7, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=8, goodsName=商品:8, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-0] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 生成产品:GoodsDto(id=9, goodsName=商品:9, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.437 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=5, goodsName=商品:5, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.438 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=6, goodsName=商品:6, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.438 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=7, goodsName=商品:7, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.438 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=8, goodsName=商品:8, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    21:44:26.438 [Thread-1] INFO com.cjw.concurrent.scxf.lock.GoodsLockService - 消费产品:GoodsDto(id=9, goodsName=商品:9, price=null, createTime=Thu Jun 27 21:44:26 CST 2019, pagList=null)
    Disconnected from the target VM, address: '127.0.0.1:62540', transport: 'socket'
    
    Process finished with exit code 0
    

     

    转载于:https://my.oschina.net/wugong/blog/3067012

    展开全文
  • Spring Boot和ActiveMQ Artemis的生产者消费者微服务教程。 涵盖的主题 Sprint Boot子休息区Api Spring启动批处理 SSL连接 JMS(Java消息服务) Swagger UI用于可视化API 错误处理 基本认证 POJO <-> DTO的映射...
  • 生产环境线程阻塞dump

    2015-03-05 00:36:51
    各位大神,帮忙分析一下异常dump,生产环境用户量增多的时候就会出现线程阻塞,导致服务器性能变慢,测试环境做压力测试没有重现,让DBA看了一下DB也没有发现异常会话、高频sql或者是性能较差的sql、数据等待等 ...
  • 基于mysql binlog实现的增量数据抽取

    千次阅读 2019-09-26 21:27:05
    但是实际生产中数据往往都是数仓的构建都是基于数据库的改变做的。Oracle和Sql server都有基于CDC的数据仓库构建方案。而mysql目前已知的方案就是基于binlog来构建数仓。也可以结合binlog和前文所讲的flink做一些...

    前几篇文章介绍了关于一些大数据的相关内容。但是实际生产中数据往往都是数仓的构建都是基于数据库的改变做的。Oracle和Sql server都有基于CDC的数据仓库构建方案。而mysql目前已知的方案就是基于binlog来构建数仓。也可以结合binlog和前文所讲的flink做一些实时计算

    代码

    binlogDto

    package com.example.demo.dto;
    
    public class BinlogDto {
        private String event;
        private Object value;
    
        public BinlogDto(String event, Object value) {
            this.event = event;
            this.value = value;
        }
    
        public BinlogDto() {
        }
    
        public String getEvent() {
            return event;
        }
    
        public void setEvent(String event) {
            this.event = event;
        }
    
        public Object getValue() {
            return value;
        }
    
        public void setValue(Object value) {
            this.value = value;
        }
    }
    
    

    Message

    package com.example.demo.dto;
    
    import java.util.Date;
    
    public class Message {
        private Long id;
        private String msg;
        private Date sendTime;
    
        public Message(Long id, String msg, Date sendTime) {
            this.id = id;
            this.msg = msg;
            this.sendTime = sendTime;
        }
    
        public Message() {
        }
    
        public Long getId() {
            return id;
        }
    
        public void setId(Long id) {
            this.id = id;
        }
    
        public String getMsg() {
            return msg;
        }
    
        public void setMsg(String msg) {
            this.msg = msg;
        }
    
        public Date getSendTime() {
            return sendTime;
        }
    
        public void setSendTime(Date sendTime) {
            this.sendTime = sendTime;
        }
    }
    
    

    KafkaSender

    package com.example.demo.kafka;
    
    
    import com.alibaba.fastjson.JSON;
    import com.example.demo.dto.Message;
    import org.apache.kafka.clients.admin.AdminClient;
    import org.apache.kafka.clients.admin.AdminClientConfig;
    import org.apache.kafka.clients.admin.NewTopic;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.kafka.core.KafkaTemplate;
    import org.springframework.stereotype.Component;
    
    import java.util.Arrays;
    import java.util.Date;
    import java.util.List;
    import java.util.Properties;
    import java.util.concurrent.TimeUnit;
    
    @Component
    public class KafkaSender {
        @Autowired
        KafkaTemplate kafkaTemplate;
    
        public void createTopic(String host,String topic,int partNum,short repeatNum) {
            Properties props = new Properties();
            props.setProperty(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,host);
    
            NewTopic newTopic = new NewTopic(topic, partNum, repeatNum);
    
            AdminClient adminClient = AdminClient.create(props);
            List<NewTopic> topicList = Arrays.asList(newTopic);
            adminClient.createTopics(topicList);
    
            adminClient.close(10, TimeUnit.SECONDS);
        }
    
        public void send(String topic,String msg){
            Message message=new Message();
            message.setId(System.currentTimeMillis());
            message.setMsg(msg);
            message.setSendTime(new Date());
            System.out.println("发送消息的topic"+topic+"发送的消息内容"+JSON.toJSONString(msg));
            kafkaTemplate.send(topic, JSON.toJSONString(msg));
            kafkaTemplate.send(topic,msg);
        }
    }
    
    

    BinlogclientRunner

    package com.example.demo.runner;
    
    import com.alibaba.fastjson.JSON;
    import com.example.demo.dto.BinlogDto;
    import com.example.demo.kafka.KafkaSender;
    import com.github.shyiko.mysql.binlog.BinaryLogClient;
    import com.github.shyiko.mysql.binlog.event.*;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.boot.CommandLineRunner;
    import org.springframework.scheduling.annotation.Async;
    import org.springframework.stereotype.Component;
    
    import java.io.Serializable;
    import java.util.Arrays;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    @Component
    public class BinlogClientRunner implements CommandLineRunner {
        @Value("${binlog.host}")
        private String host;
    
        @Value("${binlog.port}")
        private int port;
    
        @Value("${binlog.user}")
        private String user;
    
        @Value("${binlog.password}")
        private String password;
    
        // binlog server_id
        @Value("${server.id}")
        private long serverId;
    
        // kafka话题
        @Value("${kafka.topic}")
        private String topic;
    
        // kafka分区
        @Value("${kafka.partNum}")
        private int partNum;
    
        // Kafka备份数
        @Value("${kafka.repeatNum}")
        private short repeatNum;
    
        // kafka地址
        @Value("${spring.kafka.bootstrap-servers}")
        private String kafkaHost;
    
        // 指定监听的数据表
        @Value("${binlog.database.table}")
        private String database_table;
    
        @Autowired
        KafkaSender kafkaSender;
    
        @Async
        @Override
        public void run(String... args) throws Exception {
    
            // 创建topic
            kafkaSender.createTopic(kafkaHost, topic, partNum, repeatNum);
            // 获取监听数据表数组
            List<String> databaseList = Arrays.asList(database_table.split(","));
            HashMap<Long, String> tableMap = new HashMap<Long, String>();
            // 创建binlog监听客户端
            BinaryLogClient client = new BinaryLogClient(host, port, user, password);
            client.setServerId(serverId);
            client.registerEventListener((event -> {
                // binlog事件
                EventData data = event.getData();
                if (data != null) {
                    if (data instanceof TableMapEventData) {
                        TableMapEventData tableMapEventData = (TableMapEventData) data;
                        tableMap.put(tableMapEventData.getTableId(), tableMapEventData.getDatabase() + "." + tableMapEventData.getTable());
                    }
                    // update数据
                    if (data instanceof UpdateRowsEventData) {
                        UpdateRowsEventData updateRowsEventData = (UpdateRowsEventData) data;
                        String tableName = tableMap.get(updateRowsEventData.getTableId());
                        if (tableName != null && databaseList.contains(tableName)) {
                            String eventKey = tableName + ".update";
                            for (Map.Entry<Serializable[], Serializable[]> row : updateRowsEventData.getRows()) {
                                String msg = JSON.toJSONString(new BinlogDto(eventKey, row.getValue()));
                                kafkaSender.send(topic, msg);
                            }
                        }
                    }
                    // insert数据
                    else if (data instanceof WriteRowsEventData) {
                        WriteRowsEventData writeRowsEventData = (WriteRowsEventData) data;
                        String tableName = tableMap.get(writeRowsEventData.getTableId());
                        if (tableName != null && databaseList.contains(tableName)) {
                            String eventKey = tableName + ".insert";
                            for (Serializable[] row : writeRowsEventData.getRows()) {
                                String msg = JSON.toJSONString(new BinlogDto(eventKey, row));
                                kafkaSender.send(topic, msg);
                            }
                        }
                    }
                    // delete数据
                    else if (data instanceof DeleteRowsEventData) {
                        DeleteRowsEventData deleteRowsEventData = (DeleteRowsEventData) data;
                        String tableName = tableMap.get(deleteRowsEventData.getTableId());
                        if (tableName != null && databaseList.contains(tableName)) {
                            String eventKey = tableName + ".delete";
                            for (Serializable[] row : deleteRowsEventData.getRows()) {
                                String msg = JSON.toJSONString(new BinlogDto(eventKey, row));
                                kafkaSender.send(topic, msg);
                            }
                        }
                    }
                }
            }));
            client.connect();
        }
    }
    
    

    完成上述操作的前提是在mysql的配置文件中进行配置。

    log-bin=mysql-bin # 开启binlog
    binlog-format=ROW # 设置Binary Log记录方式为Row
    server_id=1 # 记住id 后续开发会使用

    然后再在我们自己的项目中进行配置

    spring.main.web-environment=false
    
    # binlog配置
    server.id=1
    binlog.host=127.0.0.1
    binlog.port=3306
    binlog.user=root
    binlog.password=123456
    # 指定监听的表格
    binlog.database.table=teemoliu.user,teemoliu.role
    
    # kafka
    spring.kafka.bootstrap-servers=localhost:9092
    kafka.topic=binlog
    kafka.partNum=1
    kafka.repeatNum=1
    

    本文转载自他人博客https://www.jianshu.com/p/5acb30ec8347

    展开全文
  • 2、数据迁移生产的文件 3、定义数据库上下文 三、DTO 0、定义dto,主要用于数据访问层和表现层的分隔 1、AutoMapper的配置、dto到实体的映射 四、Web.Api 0、存放controller 1、存放业务逻辑 ...

    项目分层结构

    在这里插入图片描述

    各层的讲解

    一、Data

    用于存放领域模型、不引入任何项目

    二、Data.SqlServer

    0、引入EF
    1、使用Fluent Api定义实体之间的关系
    2、数据迁移生产的文件
    3、定义数据库上下文

    三、DTO

    0、定义dto,主要用于数据访问层和表现层的分隔
    1、AutoMapper的配置、dto到实体的映射

    四、Web.Api

    0、存放controller
    1、存放业务逻辑
    2、前端相关

    Common、两个Common存放公共方法、与模型无关的逻辑

    展开全文
  • 绑定模型子系统 绑定模型是描述YANG ... 消费者和生产者绑定 – 绑定模型的子集,消费者和生产者直接可见这部分子集 ;它在开发(编译)时使用绑定。此子集由以下生成的Java接口组成: 数据传输对象 DTO建设者 RP
  • 根据部门和人员,生成部门人员选择树,用的是Vue的el-tree生产树。 java部分------------------------------------------------------------------------------- 1:中间实体dto(就是前端要的字段,让从数据库中...
  • 生产中查询出的List集合数据需要分页传到前端。 目录一、分页工具类二、分页工具的使用 一、分页工具类 /** * 分页工具类 */ public class PayUtil { /** * 转换WrapperResponse<PageResult>里面的...
  • springboot整合kafka

    千次阅读 2019-12-12 13:34:45
    springboot整合kafka添加maven依赖添加配置参数创建dto创建生产者添加消费者添加接口调用 添加maven依赖 <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring...
  • 本文主要介绍了基于DDD思想,在生产项目中落地应用实现的实践。本文为【DDD】系列文章中的其中一篇, 1. 框架实现图 该框架实现基本和DDD的指导思想契合,主要分为四层,且将关注点放在了domain层。下面将...
  • 在很多的生产中,hibernate并不能满足我们所有的开发需求,比如,很多表的联合查询,并且查询之后的各种结果封装在自定义的dto对象中,那么我们就需要使用自定义的sql进行查询了,好了,开始我们新的旅程吧。...
  • 绑定模型是描述YANG Schema和绑定无关数据格式如何转换为生成绑定(generated binding 静态类型的Java接口、DTO、构建器和映射器)的规范。绑定模型有两个子系统: (1).消费者和生产者绑定 -- 绑定模型的子集,...
  • 某自动化制造业生产,需要在A-5工位上打标并生成真实的生产条形码,生成的真实条形码需要覆盖之前的A-1,A-2,A-3,A-4的虚拟条形码。并且B工站组,C攻占组,.....N工站组都有相同的需求。而且需要覆盖的工站不固定。 ...
  • rocketmq---------common-------MessageData(消息传输DTO) | |---producer----------RocketMQProducer(生产者接口) | | | |---RocketMQProducerImpl(生产者接口实现) |---consumer----...
  • 定义的Dto怎么接收到查询的结果呢?今天就来讲讲如何返回自定义的结果。还是以公司生产产品为例子。第一种返回方式:关系对象,节点对象。这种返回方式就是把定义的关系类和节点类直接作为接收对象返回。首先定义...
  • 如果生产者返回给消费者的对象中有未实现Serializable接口的,都会报出如下错误: 最关键的一句 Serialized class com.yykj.mall.dto.ProductListItemDTO must implement java.io.Serializable 但报错的时候是...
  • springboot dubbo整合 demo

    2017-06-09 14:11:03
    本示例是使用springboot(1.4.6.RELEASE)版本与dubbox整合的示例,项目采用为服务结构为基础,代码中包含client(基础包,包含各服务间接口及接口dto,作为其他服务的依赖包,不需要启动)、consumer(服务消费者)、...

空空如也

空空如也

1 2 3 4
收藏数 64
精华内容 25
关键字:

dto生产