Giter Club home page Giter Club logo

Comments (11)

nieqiurong avatar nieqiurong commented on July 21, 2024

虽然可以修改成普通的ArrayList,但这大概率也可以通过升级fastjson解决.

from mybatis-plus.

Alleninggx avatar Alleninggx commented on July 21, 2024

fastjson已经是最新版本了

from mybatis-plus.

nieqiurong avatar nieqiurong commented on July 21, 2024

image
测试看着没什么问题,你断点看下readJSONBObject方法里面的参数把.

from mybatis-plus.

nieqiurong avatar nieqiurong commented on July 21, 2024

不确定是不是些这样的问题.
alibaba/fastjson2#1835

from mybatis-plus.

Alleninggx avatar Alleninggx commented on July 21, 2024

看issue里描述是同一个问题,我看看fastjson2那边能不能解决吧

from mybatis-plus.

nieqiurong avatar nieqiurong commented on July 21, 2024

拿fastjson的代码验证了一下,只有存在属性为public的情况才能复现这个情况,不确定是否为同个情况,需要补充复现工程来看看.

from mybatis-plus.

nieqiurong avatar nieqiurong commented on July 21, 2024

你的响应模型是自定义的还是直接PageDto?

public class App {

    public static void main(String[] args) {
        Page<Person> page = new Page<>();
        List<Person> data = new ArrayList<>();
        data.add(null);
        data.add(new Person("abc"));
        data.add(null);
        // page.data = Collections.unmodifiableList(data);
        page.setData(data);
        byte[] bytes = JSONB.toBytes(page);
        Page page1 = JSONB.parseObject(bytes, Page.class);
        System.out.println(page1);

    }

    public static class Person {
        private String name;

        public Person() {
        }

        public Person(String name) {
            this.name = name;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

    }

    public static class Page<T> {

        // 属性为public下才会出问题.
        public List<T> data = Collections.emptyList();

        public void setData(List<T> items) {
            this.data = items;
        }

        public List<T> getData() {
            return data;
        }

    }

}

from mybatis-plus.

Alleninggx avatar Alleninggx commented on July 21, 2024

Mapper定义了这个,然后一路原样返返回(mapper->service->dubbo->另一个server)。

Mapper:
image
Dubbo:
image

在Dubbo序列化前,具体类型是Page。

from mybatis-plus.

Alleninggx avatar Alleninggx commented on July 21, 2024

@nieqiurong https://github.com/Alleninggx/MybatisPlus-test
这是复现工程
image

改一下redis地址,先启动provider,再启动customer

from mybatis-plus.

nieqiurong avatar nieqiurong commented on July 21, 2024

image
发现是开启了这个就有影响,具体还得看下fastjson源码了.

from mybatis-plus.

nieqiurong avatar nieqiurong commented on July 21, 2024

alibaba/fastjson2#2734

from mybatis-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.