Reputation: 581
If I have a Serializable class,
public class Solar implements Serializable {
@Autowired
private CategoryDAO categoryDAO;
}
This message is shown when I Built the findBugs with this message :
This Serializable class defines a non-primitive instance field which is neither transient, Serializable, or java.lang.Object, and does not appear to implement the Externalizable interface or the readObject() and writeObject() methods. Objects of this class will not be deserialized correctly if a non-Serializable object is stored in this field.
what should the fields be to don't look like bug?
Upvotes: 0
Views: 1010
Reputation: 1994
This does not have anything to do with Spring. Looks like it is only about (de-)serialization of a class which is serializable but defines a fields that isn't.
Serializable
is defined on class level - like you did with Solar
(not on field level).
However, if we are talking about a real DAO here, it should be rather marked transient - it does not make sense to serialize a DAO to me.
Upvotes: 1