男人创造作品,而女人创造男人——罗曼·罗兰 代码如下: 1234567891011121314151617181920212223242526272829package com.ruben.simplebootimport org.junit.jupiter.api.Testimport org.springframework.beans.factory.BeanFactoryimport org.springframework.beans.factory.annotation.Autowiredimport org.springframework.boot.test.context.SpringBootTestimport org.springframework.context.expression.BeanFactoryResolverimport org.springframework.expression.spel.standard.SpelExpressionParserimport org.springframework.expression.spel.support.StandardEvaluationContext/** * @author VampireAchao * @since 2022/10/18 17:08 */@SpringBootTestclass SPELTest { @Test fun test(@Autowired beanFactory: BeanFactory) { val expression = SpelExpressionParser() .parseExpression("1+(@userInfoMapper.limit(20L).size()+20)*4") val value = expression.getValue(StandardEvaluationContext().apply { setBeanResolver(BeanFactoryResolver(beanFactory)) }) print(value) }}