Spring Aop中解析spel表达式,实现更灵活的功能
前言 在Spring Aop中,我们可以拿到拦截方法的参数,如果能结合spel表达式,就能实现更加灵活的功能。典型的实现有Spring的缓存注解: 1@Cacheable(value = "user", key = "#id", condition = "#id lt 10") 2public User conditionFindById(final Long id) { 3} 1@Caching(put = { 2@CachePut(value = "user", key = "#user.id"), 3@CachePut(value = "user", key = "#user.username"), 4@CachePut(value = "user", key = "#user.email") 5}) 6public User save(User user) { 本文介绍如何在aop编程中解析spel表达式,提供几个通用的方法。 ...
