All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mountain.framework.controller.valid.BodyController Maven / Gradle / Ivy

package com.mountain.framework.controller.valid;

import com.mountain.framework.utils.Response;
import javax.validation.groups.Default;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * json参数校验
 */
@RestController
public class BodyController {
    @PostMapping("/test")
    public Response testPost(@Validated @RequestBody ReqDto req) {
        return Response.success();
    }

    @PutMapping("/test")
    public Response testPut(@Validated({Default.class, ReqDto.Update.class}) @RequestBody ReqDto req) {
        return Response.success();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy