Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
Are JavaBeans No Longer Required to Be Serializable?

I'm a C# developer who has recently been thrown onto a Java team at my company. We use Jakarta Bean Validation in our spring-based microservices, and I've been trying to read through the specification to get a better understanding of the framework. However, I've noticed what I believe to be an inconsistency in the documentation.

When reading through the Jakarta Bean Validation specification (https://beanvalidation.org/2.0/spec/), it states that "the Jakarta Bean Validation specification defines a framework for declaring constraints on JavaBean classes, fields and properties.

Later on in the specification, it uses the following class as an example JavaBean to demonstrate the validation annotations provided by the framework.

public class Address {

@NotNull @Size(max=30)
private String addressline1;

@Size(max=30)
private String addressline2;

private String zipCode;

private String city;

public String getAddressline1() {
    return addressline1;
}

public void setAddressline1(String addressline1) {
    this.addressline1 = addressline1;
}

public String getAddressline2() {
    return addressline2;
}

public void setAddressline2(String addressline2) {
    this.addressline2 = addressline2;
}

public String getZipCode() {
    return zipCode;
}

public void setZipCode(String zipCode) {
    this.zipCode = zipCode;
}

@Size(max=30) @NotNull
public String getCity() {
    return city;
}

public void setCity(String city) {
    this.city = city;
}

}

However, based on what I have read online, this class does not fit the definition of a JavaBean, since it does not implement the Serializable interface.

In the very next paragraph (https://beanvalidation.org/2.0/spec/#constraintdeclarationvalidationprocess-requirements), the specification then states that the only real requirement of classes to be validated is that they follow the getter/setter convention of the JavaBeans spec.

So, if the specification is named Java Bean Validation, and they explicitly state the goal is to define constraints on JavaBean classes, then why does the example and constraint requirements not adhere to the need for serializability?

Are JavaBeans no longer required to be serializable or is this documentation actually inconsistent?

I realize I'm probably overthinking this, but as someone new to the Java ecosystem, I'd like to make sure I have a strong understanding of fundamentals like this.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda