0

I established a Spring Boot project with jersey starter and log4j2 starter as well as added a resource class as below:

@Controller
@Path("test")
public class TestResource {

    @POST
    public String hello(@Valid Message message) {
        return message.getMsg();
    }

}

When I visit the action, the following exception would be thrown.

java.lang.annotation.AnnotationFormatError: Duplicate annotation for class: interface javax.validation.Valid: @javax.validation.Valid()

But if I remove log4j2 starter dependency from pom.xml, there will be no such weird problem.

Does anyone know what happened to the situation?

Weston Tan
  • 21
  • 3

1 Answers1

1

The problem was fixed by simply clicking the "Clean and Build Project" button (Netbeans) before clicking the "Run Project" or "Debug Project."

But I don't know what the exact problem is.

As far as I understood, there is no need to click the "Clean and Build Project" button before clicking the "Run Project" or "Debug Project."

Weston Tan
  • 21
  • 3