I realized that I have covered most of the major functions in the Spring 3 release, but completely overlooked SpEL. Now even though I am a huge Spring fan, all this functionality does actually scare me a little bit. To often have I seen people hang themselves with awesome, innocent looking ropes just like this one. Soon there will be some project that needs to be "dynamic" and some person/consultant/architect/developer will have this amazing idea and place code somewhere they can edit it externally. Then this SpEL can read this and "dynamically do stuff"...
(I am pretty sure that I have been that "person" somewhere in my career, it all feels horribly familiar.)
And all of that only comes at the price of some poor developers' sanity trying to maintain it. To be fair, this view is purely based on personal experiences and maybe slightly unjustified, but I have seen my share of good ideas gone bad in my time and it feels like SpEL is wide open for misuse.
Putting my concerns aside and refocusing on: it's something new , it's shiny and Spring-made so I obviously can't resist trying it out.
First I go digging for information to answer: "What is SpEL, Spring Expression Language?"
A quick summary of what I find:
It is an expression language that supports querying and manipulating objects at runtime. It can be used as part of the standard configuration, XML or annotation based, but can also be evaluated directly by the application code. It allows you to overcome the limitation of using only fixed values. It can be used for bean definitions in both XML- and annotation-based configurations. There is a facility to access system, environment and context parameters.
I have just covered thing that I would generally need or have run into... there is however quite a bit more information within the Spring documentation
So using Maven first thing I needed was to add following:
Using SpEL in Code:
Below I have examples code of: Setting a value, Calling a constructor, creating variables, calling a static function, all the basic operators, the instanceof operator and even the ternary if.
Using SpEL in XML Config:
As with the Java code, here is the same functionality within you Spring application XML.
Using SpEL in Annotations:
And then again will the @Value annotation.
Subscribe to:
Post Comments (Atom)
Popular Posts
-
I have recently been slacking on content on my blog, between long stressful hours at work and to the wonderful toy that is an iPhone, I have...
-
I make no claim to be a "computer scientist" or a software "engineer", those titles alone can spark some debate, I regar...
-
I saw an article (well more of a rant) the other day, by Rob Williams Brain Drain in enterprise Dev . I have to say, I do agree with some o...
-
This series of posts will be about me getting to grips with JBoss Drools . The reasoning behind it is: SAP bought out my company's curre...
-
Update: Check out my updated re-certification on the new 2019 exam... here Let me start by saying, for this certification I studied and...
Thanks, nice explanation.
ReplyDeleteNice information about spring expression language My sincere thanks for sharing this post Please Continue to share this post
ReplyDeleteJava Training in Chennai
nice blog has been shared by you. before i read this blog i didn't have any knowledge about this but now i got some knowledge. so keep on sharing such kind of an interesting blogs.
ReplyDeletejava training in chennai
This is extremely great information from your blog.
ReplyDeleteCCNP Training Institute in Chennai | CCNP Certification Training in Chennai | CCNP Routing Training in Chennai
Excellent post!!! Java is most popular and efficient programming language available in the market today. It helps developers to create stunning desktop/web applications loaded with stunning functionalities.
ReplyDeleteCore Java Online Training
Your information about Java is useful for me to know more technical information. If it in terms of Job opportunities, again Java outscore everyone.Anybody want to learn
ReplyDeleteCore Java Online Training
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work. Selenium Training in Chennai | Software Testing Training in Chennai
ReplyDeleteExcellent post. i have read your blog is very interesting.
ReplyDeleteBest Embedded Systems Training in Chennai | C & C++ Training Institute in Chennai | No.1 Embedded Training in Chennai
I have read your blog its very Interesting and informative..Thank you for this valuable information..
ReplyDeleteBest Cloud Computing Project Center in Chennai | Best BigData Project Center in Chennai | Best Image Processing Project Center in Chennai
It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
ReplyDeleteBest BE | B.Tech Project Center in Chennai | ME | M.Tech Project Center in Chennai | Best IT Project Center in Chennai
thanks for the great source https://seotraining.co/
ReplyDeleteVery nice article. Thanks for sharing. Austere Technologies Services | No.1 Cloud Solutins Company | Austere Technologies Cloud Solutins
ReplyDeleteExcellent post. Thanks for sharing such nice and useful post, Keep updating.
ReplyDeleteNO.1 APP DEVELOPMENT SERVICES | MASSIL TECHNOLOGIES
very interesting post, i am glad to see your post. Thanks for sharing. keep updating.
ReplyDeleteMASSIL TECHNOLOGIES | ORACLE CLOUD SERVICES FOR APPLICATION DEVELOPMENT SERVICES
REALLY VERY EXCELLENT INFORMATION. I AM VERY GLAD TO SEE YOUR BLOG FOR THIS INFORMATION. THANKS FOR SHARING. KEEP UPDATING.
ReplyDeleteBest Digital Transformation Services | DM Services | Austere Technologies
Superb blog, very interesting information. Thanks for sharing.
ReplyDeleteBest Mobility Services | Austere Technologies
Great informative blog. Thanks for sharing such nice article, keep on up dating such good articles.
ReplyDeleteBest IT Security Services | Austere Technologies
I love such blogs.
ReplyDeleteThank you for sharing this valuable information. But get out of this busy life and find some peace with a beautiful trip book best Andaman honeymoon packages
ReplyDeleteThank you for sharing this valuable information. But get out this busy life and find some peace with a beautiful trip. book CHEAP ANDAMAN PACKAGES @9999
ReplyDeleteExcellent informative blog, keep for sharing.
ReplyDeleteBest System Integration services | Massil Technologies
Excellent informative blog, keep sharing.
ReplyDeleteCA institute in hyderabad | Avinash College of Commerce
Hi Thanks for the nice information its very useful to read your blog. We provide best Association Of Chartered Certified Accountants
ReplyDeleteLooks nice post ethical hacking online course
ReplyDeleteGood informative article keep update articles
ReplyDeleteBest BBA College in Hyderabad
Aivivu đại lý vé máy bay, tham khảo
ReplyDeleteVe may bay di My
mua vé về việt nam
vé máy bay từ tokyo vé hà nội
vé máy bay từ frankfurt đi hà nội
vé máy bay giá rẻ từ Canada về Việt Nam
Lịch bay từ Hàn Quốc về Việt Nam hôm nay
chuyen bay chuyen gia ve viet nam