简体   繁体   中英

How spring evaluates SPEL internally?

For example, we have an expression like this 'hasAnyRole("ROLE_1","ROLE_2")'

I know that Python has a function like eval to run code from a string. But how it works here? How Spring in Java parses the expression? Does it run it? If yes then how?

My primary question is how Python runs the string containing the expression. How does he understand what to do?

SpEL has a full-blown parser and builds an AST for the expression.

In this case, the evaluation calls the hasAnyRole() method on the root object for the evaluation.

You can dig into the details in a debugger to see the actual workings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM