相對於 Spring boot 的 path variable ;Solon 的不需註解,只要變數名對上即可:
//path var demo
//
@XMapping("e/{p_q}/{obj}/{id}")
public String test_e(XContext ctx, String p_q, String obj, String id) {
return ctx.path() + "::" + p_q + "-" + obj + "-" + id;
}
注:maven-compiler-plugin
新增編譯引數:-parameters
,例:
<!-- 框架引用 -->
<dependency>
<groupId>org.noear</groupId>
<artifactId>solon-web</artifactId>
<version>1.0.10</version>
<type>pom</type>
</dependency>
<!-- 編譯外掛配置 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgument>-parameters</compilerArgument>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>