在Spring MVC中,我们通常使用Thymeleaf、Freemarker或者JSP作为视图技术来渲染页面。但有时候,我们可能不希望返回一个JSP页面,而是返回JSON、XML或者其他格式的数据。以下是一个不返回JSP页面的示例。
我们需要创建一个Controller来处理请求:

```java
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class MyController {
@GetMapping("







