본문 바로가기
SpringBoot

[Spring Boot][Error] the serializable class does not declare a static final serialversionuid field of type long

by 청양호박이 2019. 12. 25.

해당 error는 사실은 error까지는 아니고... warning에 해당합니다. 

(the serializable class does not declare a static final serialversionuid field of type long)

 

객체를 transfer하거나 write하기 위해서는 직렬화를 해야하는데... 보통 그 아이들은 implements Serializable이 되어 있습니다. 하지만 해당 항목은 warining에 불과하기 때문에 조치를 하지 않는다고 문제가 되지는 않습니다. 왜냐하면 JVM이 자동으로 생성해주기 때문입니다.

 

이를 해결하기 위해서는 2가지 방법이 있습니다. 

 

  • (권장) eclipse에서 자동으로 add generate 해주는 기능 사용
  • (비권장) @SuppressWarnings("serial")

add generate해주면... 아래와 같이 추가가 됩니다.

 

ex) private static final long serialVersionUID = 6528917391990639678L;

댓글