The difference between #{} and ${} in interview mybatis

${} is a string replacement, mybatis is processing ${}, which is to directly replace the value in ${} with the value of the variable

And #{} is preprocessing, it will preprocess the sql statement, first use the placeholder? Instead, call the set of PreparedStatement to assign.

In summary, #{} is more secure than ${}, and can prevent injection, etc. If you can use #{}, use #{} as much as possible.

Supongo que te gusta

Origin blog.csdn.net/weixin_69218754/article/details/130790187
Recomendado
Clasificación