在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"/>
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: mybatis是如何防止SQL注入的