首页 > 解决方案 > 使用 spring rest 文档时,如何在描述中换行?

问题描述

我尝试了 \n 或 br 标记来换行,但它不起作用。

requestParameters(
                parameterWithName("name").description("This is the description <br/> in the table."),
<td class="tableblock halign-left valign-top"><p class="tableblock">This is the description &lt;br/&gt; in the table.</p></td>

如何在描述中换行?

标签: springspring-restdocs

解决方案


您只需要将"+"字符串中的一个额外字符与换行符结合起来\n

parameterWithName("name").description("This is the description +" + "\n" + "in the table."),

推荐阅读