在项目开发中,接口与接口之间,前后端之间数据的传输都使用 Json 格式,在 Spring Boot 中,接口 返回 Json 格式的数据很简单,在 Controller 中使用 @RestController 注解即可返回 Json 格式的数据.
@ResponseBody 注解是将返回 的数据结构转换为 Json 格式。所以在默认情况下,使用了 @RestController 注解即可将返回的数据 结构转换成 Json 格式.
在项目开发中,接口与接口之间,前后端之间数据的传输都使用 Json 格式,在 Spring Boot 中,接口 返回 Json 格式的数据很简单,在 Controller 中使用 @RestController 注解即可返回 Json 格式的数据.
@ResponseBody 注解是将返回 的数据结构转换为 Json 格式。所以在默认情况下,使用了 @RestController 注解即可将返回的数据 结构转换成 Json 格式.