lebronjamesuit / social-media-platforms

Build an backend app social media, secure my API using Spring Security 6 and Auth0. Deployed AWS.
https://lbconfessionapis-2012569758.eu-west-2.elb.amazonaws.com/swagger-ui/index.html
1 stars 0 forks source link

RequestLoginDTO without default constructor can't be processed for deserialization #5

Open lebronjamesuit opened 1 year ago

lebronjamesuit commented 1 year ago

o.s.web.method.HandlerMethod : Could not resolve parameter [0] in public com.social.media.confessionmedia.authorizationserver.controller.AuthenticationController.logIn(RequestLoginDTO) throws java.lang.Exception: Type definition error: [simple type, class RequestLoginDTO]

lebronjamesuit commented 1 year ago

https://shorturl.at/K1368

lebronjamesuit commented 1 year ago

ObjectMapper also expects an accessible default constructor, that is, one that takes no parameters.

Be careful when work with Lombox, Jackson needs two things to work deserialization.

  1. I need a default constructor to allow for Jackson to perform it's deserialization actions correctly.
  2. Setter
@Data
@AllArgsConstructor. // Optional
@NoArgsConstructor
public class RequestLoginDTO {
    private String username;
    private String password;
}