在MyBatis中,可以通過以下方式引用屬性:
${}
占位符來引用屬性,例如:<select id="selectUser" parameterType="int" resultType="User">
SELECT * FROM users WHERE id = ${userId}
</select>
@Value
注解來引用屬性,例如:@Value("${mybatis.mapperLocations}")
private String mapperLocations;
${}
占位符來引用屬性,例如:<properties resource="mybatis-config.properties"/>