Spring Aop中解析spel表达式,实现更灵活的功能

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

2019年2月25日 · 2 分钟 · 807 字