Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

适用spel的#root.target #427

Merged
merged 1 commit into from
Jun 8, 2022
Merged

Conversation

huaibingshifu
Copy link
Contributor

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style
  • Refactor
  • Doc
  • Other, please describe:

The description of the PR:

  • 增加DsSpelExpressionProcessor对spel表达式中#root变量的支持

Other information:

改动之前只能从方法入参中取属性值,改动后增加从当前被调用的目标对象实例的变量中取属性值

@huayanYu
Copy link
Member

举个栗子或场景。

@huaibingshifu
Copy link
Contributor Author

huaibingshifu commented May 20, 2022

@Service
public class A {

    @Value("${value01}")
    private String aProperty;

    @DS("#root.target.aProperty")
    public void insert(String param0, String param1) {
        // ...
    }
}

如上示例:改动DsSpelExpressionProcessor之前,@DS 只能从方法入参中取值(只能从param0/param1中取值);改动后,可以从当前被调用的目标对象实例A的变量中(A的变量aProperty)取值

@huayanYu huayanYu merged commit 709223d into baomidou:master Jun 8, 2022
@cnzbq
Copy link

cnzbq commented Jul 19, 2022

需要为aProperty提供一个get方法

@Getter
@Value("${value01}")
private String aProperty;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants