NotSerializableException on serialization of objects currently shown by Vaadin

前端 未结 1 971
北海茫月
北海茫月 2021-01-26 11:50

I get a NotSerializableException when I want to serialize an Object that is currently shown by Vaadin.

The structure is like this:

Vaadin UI <--- serialize /

相关标签:
1条回答
  • 2021-01-26 12:02

    Spring components are usually not serializable (or should not be serialized at all).

    Injecting Spring components in Vaadin components linked to a Vaadin UI is tricky because them should be declared as transient and re-populated after deserialization..

    I wrote a small library jdal-aop to ease the process, using spring-aop serializable proxies.

    for example

    public class MainLayout extends VerticalLayout {
    
        @Autowired
        @SerializableProxy  // make this Dao serializable
        private CustomerDao customerDao;
    } 
    

    It could be useful for you.

    0 讨论(0)
提交回复
热议问题