Pregunta

I want to know if is possible to use Lombok with Spring, because in my project I got stack trace because I didn´t have a getter or setter method, but I put @getter and @setter annotations in my code.

@Data
public class EmailBean {

    @Getter @Setter
    private String contato;
    @Getter @Setter
    private String contatoCopia;
    @Getter @Setter
    private String copiaOculta;
    @Getter @Setter
    private String titulo;
    @Getter @Setter
    private String mensagem;

    @Getter @Setter
    private List<Contato> listaContatosSelecionados;
    @Getter @Setter
    private Set<String> setEmails;

    @Getter @Setter
    private boolean mostrar;

    @Getter @Setter
    private EmailHelper helper;
    @Getter @Setter
    private EmailFilter filter;

    public boolean mostrarListener() {
        this.mostrar = true;
        return this.mostrar;
    }
}

So anyone, can help me?

¿Fue útil?

Solución

You probably need to override canEquals. See http://projectlombok.org/features/EqualsAndHashCode.html for more information.

Otros consejos

So your @Getter and @Setter annotations in there are redundant. @Data applies getters and setters to all fields in the class.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top