阅读量:108
在MyBatis中,可以通过以下方式引用属性:
- 在Mapper XML文件中使用
${}占位符来引用属性,例如:
<select id="selectUser" parameterType="int" resultType="User">
SELECT * FROM users WHERE id = ${userId}
</select>
- 在Java代码中使用
@Value注解来引用属性,例如:
@Value("${mybatis.mapperLocations}")
private String mapperLocations;
- 在MyBatis配置文件中使用
${}占位符来引用属性,例如:
<properties resource="mybatis-config.properties"/>