Spring 6 and MyBatis 3.5 Utility Classes: Safe Usage and Version Boundaries
Baseline: Spring Framework 6, Spring Boot 3, MyBatis 3.5.x, and Java 17+. Use the Javadocs for the current dependencies as the source of truth for utility class signatures and package names.
1. Beans and Properties
BeanUtils.copyProperties performs a shallow copy and cannot replace a mapping framework. BeanWrapper, DataBinder, and ConversionService are suitable for binding within frameworks. When binding in bulk, restrict the allowed fields so users cannot modify properties that should not be exposed.
2. Reflection and Expressions
Input sources for ReflectionUtils, MethodInvoker, SpEL, and OGNL should all be restricted. Never execute user input directly as a class name, method name, expression, or SQL fragment. Caching expressions does not replace authorization checks.
3. AOP and Proxies
AopUtils, ProxyFactory, and Advisor are infrastructure components. Proxy type, self-invocation, the bean lifecycle, and the choice between JDK and CGLIB proxies must all be evaluated against the actual bean configuration.
4. SQL and MyBatis
In MyBatis, #{} uses prepared-statement parameters, while ${} should only be used with whitelisted structural fragments. The final SQL produced by plugins, pagination, tenant isolation, and logical deletion must be verified through integration tests.
5. Usage Principles
These utilities address individual mechanisms, not a general-purpose architecture. After upgrading to Spring 6 or a newer MyBatis 3.5 patch release, recompile the examples and check for deprecated APIs, package names, and module dependencies.