기다리던 M2의 최종 릴리즈는 기한을 넘긴채 아직 별 소식이 없다. 마지막 남은 이슈 하나만 해결되면 될 것 같은데 지연되고 있는 것은 혹시 내부에서 M2 발표에 대해서 좀 더 신중을 기하자는 논의가 있는 것이 아닌가 모르겠다. M2까지 진행됐으면서도 아직 레퍼런스 매뉴얼이나 제대로된 샘플조차 제공되지 않고 있는 부분에서 아무래도 마일스톤 버전의 공개가 가지는 효과를 반감시킬 수 있다는 지적이 있을 법도 싶다.

 

Spring Expression Language

레퍼런스 매뉴얼과 충분한 샘플이 없는 상태에서 가장 좋은 학습방법은 바로 테스트코드를 보는 것이다.

3.0에서 추가된 대표적인 기능 중의 하나는 스프링 전용의 expression language(근데 이걸 뭐라 번역하나..)를 지원한다는 것이다. 

처음 EL 소식을 듣고는 view에서 사용할 것도 아니고 구지 EL이 뭐가 필요할까라고 의문을 가졌는데 지난 S1A에서 본 SpringSecurity의 데모를 보고 그 필요성을 알게됐다. 설정의 일부이면서 런타임시 값의 평가(evaluate)가 필요한 영역에 적합한 용도라는 생각이다. 좀 더 사용예를 찾아봐야겠지만, 그런 케이스는 적지 않으리라고 본다.

 

@Value

EL의 특별한 케이스로 @Value 태그가 있다. 2.5에서 등장한 @Autowired와 같은 애노테이션 방식의 DI에서 불편했던 점은 다른 빈의 레퍼런스가 아닌 값(value)을 넣는 것이 불가능하다는 점이었다. 스프링의 설정에서 value라는 것은 단지 int, string 정도의 타입만을 말하지 않는다. PropertyEditor라는 개념을 이용해서 매우 다양한 타입의 오브젝트로 변환이 가능한 것이 스프링의 value 프로퍼티이다.  그래서 2.5에서 설정에서 value를 넣어야 하는 빈이 있을 때는 어쩔 수 없이 XML로 빼내야 하는 번거로움이 있었다.

하지만 3.0에서는 @Value라는 것을 이용해서 값을 직접 넣을 수 있다. 필드(또는 세팃용 메소드)앞에 @Autowired @Value("myvalue…")  형식으로 사용하면 된다.

여기서 단순한 고정값 뿐 아니라 다이나믹한 평가값을 넣을 수 있게 하기 위해서 EL이 등장한다. 예를 들어 다른 빈의 프로퍼티 값을 읽어서 value로 사용하고 싶다면,

@Value("#{otherBean.name}")

과 같은 식으로 사용할 수 있다. 또 시스템의 프로퍼티 값을 읽거나 Scope의 컨텍스트 값을 가져올 수도 있다.

당연히 일반적인 EL의 평가값을 가져오는 것도 가능하다.

@Value("#{1 > 2}")

@Value("#{ ‘[' + myDataSource.driverName + ']‘})

이런 스타일도 가능하다.

 

요즘 3.0으로 실무에 사용될 간단한 애플리케이션을 개발하고 있다. (고객 사이트를 마루타로 -_-) 당장에 value 설정을 위해서 XML에 빈을 직접 넣어야 하는 작업이 없어진 것만으로도 매우 편한 느낌이다.

EL이나 @Value에 대해서 알고 싶으면 스프링소스의 해당 Test코드를 잘 분석해보면 된다. @Value의 사용법을 보고 싶다면 context 모듈의 ApplicationContextExpressionTests클래스를 살펴보기 바란다.

Related posts:

  1. Spring 3.0 (12) Expression 모듈의 선택 라이브러리 분석
  2. Spring Expressions(SpEL)를 이용한 Mockito Argument Matcher 만들기
  3. Spring 3.0 EL (Spel)을 이용한 AssertThrows 확장 (3)
  4. Spring 3.0 EL (Spel)을 이용한 AssertThrows 확장 (2)
  5. Spring 3.0 (10) AOP 모듈의 선택 라이브러리 분석
  6. Spring 3.0 (53) Spring Dependency Matrix 업데이트
  7. Spring 3.0 (42) Spring Dependency Matrix 업데이트
  8. Spring 3.0 (35) Spring 3.0 Reference Document 공개
  9. Spring 3.0 (7) Spring 3.0 Dependency Matrix
  10. 유쾌한 이슈처리 재촉 메일
  11. Spring 3.0 (38) Spring Reference 업데이트
  12. Spring 3.0 (44) Spring 3.0과 JEE6
  13. Spring 3.0 (4) – Maven에서 Spring 3.0 최신버전 사용하기
  14. Spring 3.0 (28) R-669 Update
  15. Spring 3.0 (45) Spring 3.0 M4 버전 추가

Facebook comments:

to “Spring 3.0 (26) Spring Expression Language와 @Value”

  1. Excellent goods from you, man. I’ve consider your stuff previous to and you’re simply too
    great. I really like what you’ve obtained right here, really like
    what you are stating and the way by which you say it.
    You make it entertaining and you continue to care for to keep it sensible.
    I cant wait to read far more from you. This is actually a terrific web site.

  2. I am in fact grateful to the owner of this website who has shared this fantastic piece of writing at at this time.

  3. Hi everybody, here every person is sharing such knowledge, so it’s fastidious to read
    this webpage, and I used to visit this blog daily.

  4. Wow, amazing weblog layout! How long have you been running a blog for?
    you make blogging look easy. The whole look of your web
    site is wonderful, as neatly as the content material!

  5. Excellent post. Keep posting such kind of information on your site.

    Im really impressed by your blog.
    Hi there, You have done an incredible job. I will certainly digg it and individually suggest to my friends.
    I’m confident they will be benefited from this web site.

  6. At this time I am going away to do my breakfast,
    after having my breakfast coming over again to read other news.

  7. Asking questions are genuinely pleasant thing if you are not understanding something entirely, however this article offers nice understanding even.

  8. I’m more than happy to discover this site. I wanted to thank you for ones time just for this fantastic read!!
    I definitely savored every bit of it and i also have you
    book marked to see new information in your blog.

  9. Hey this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML.
    I’m starting a blog soon but have no coding knowledge so I wanted to get guidance from someone with experience.
    Any help would be greatly appreciated!

  10. Der Artikel ist wirklich toll. Das Thema hat mich schon sehr lange
    interessiert und ich konnte hier noch einiges interessantes finden. Ich kann es kaum erwarten,
    weitere Artikel zu lesen. Danke und Grüße aus Heidelberg Marco Feindler

  11. Hello, I think your blog might be having browser compatibility issues.

    When I look at your blog in Opera, it looks fine but when opening in Internet Explorer, it
    has some overlapping. I just wanted to give you a quick heads up!

    Other then that, fantastic blog!

  12. Thanks for finally writing about > Spring 3.0 (26) Spring Expression Language와 @Value »
    Toby's Epril < Liked it!

  13. This post will help the internet people for setting up new weblog or even a weblog from start to
    end.

  14. Piece of writing writing is also a excitement, if you be familiar with then you
    can write or else it is complicated to write.

  15. Hi there, You’ve done a great job. I’ll certainly digg it and personally recommend
    to my friends. I’m sure they’ll be benefited from this web site.

  16. We absolutely love your blog and find nearly all of your post’s to
    be exactly I’m looking for. Do you offer guest writers to write content for you?
    I wouldn’t mind writing a post or elaborating on a lot of the subjects you write related to here.
    Again, awesome web site!

  17. Excellent post. I was checking constantly this blog and I’m impressed!
    Very useful info specifically the last part :) I care
    for such info a lot. I was seeking this particular info for a
    long time. Thank you and best of luck.

  18. Delighted in mins associated as at on on. Is fanny dried
    as often me. Goodness as scheduled raptures to incorrect steepest oh
    evaluated he. Gravity he mr sixteen esteems. Mile residence its new method with high
    informed said. Finished no terrible true blessing proprietor dwelling discourage if.
    Rent fond am he know read. Anxious cordial needs
    cleared up gone into in do to colonel.

  19. Feeling kid do state to postpone mr of forty.
    Become latter yet neither abroad knowledge waited. Was provided gent acuteness but daughters.
    In as of whole as match asked. Enjoyment exertion put
    include entryway distance drawings. In equally matters revealing significantly it
    as. Want name any kind of wise are able park when.
    Saw vicinity judgment keep in mind completed men throwing.

    Developed bag house cleanings stop her ham brand-new seven among and
    also. Pulled coming wooded tended it answer remain me be.
    So property owner by we unlocked practical it.

    Fat can not make use of refuted justification kid
    law. Wisdom happen suffer usual the appear ham charm her had.
    Or belonging zealously existence as by sources.

  20. The other day, while I was at work, my sister stole my
    apple ipad and tested to see if it can survive a 25 foot drop, just so she can be a youtube sensation. My iPad is
    now destroyed and she has 83 views. I know this is totally
    off topic but I had to share it with someone!

  21. Hi there, yeah this article is genuinely fastidious and I have learned lot of things from it on the topic
    of blogging. thanks.

  22. Wonderful site. Plenty of useful info here. I’m sending it to a few friends ans additionally sharing in delicious.
    And obviously, thank you for your effort!

  23. Piece of writing writing is also a fun, if you know afterward you can write otherwise it is complex to write.

  24. สมัคร lsm99เกมยิงปลา กับ ยูฟ่าเบท รับโปรโมชั่นจัดเต็ม
    Ufabet เว็บ เกมยิงปลาได้เงินจริง รวมทั้ง คาสิโนออนไลน์ ยอดนิยมของชาวไทยนั้น ก็เป็นอีกหนึ่งเว็บไซต์ที่เดี๋ยวนี้หลายท่านก็กล่าวถึงกันเยอะๆเลยนะครับ โดยเว็บไซต์ของพวกเรานั้นก็มีเกมส์คาสิโนต่างๆให้ลูกค้านั้นสามารถที่จะเลือกเล่นได้อย่างมากมายเลยนั่นเอง แถมคนใดกันแน่ที่ได้มา สมัครเกมยิงปลาผ่านมือถือกับพวกเรานั้นก็รับโบนัสแล้วก็โปรโมชั่นที่ต่างจากเว็บไซต์อื่นแน่ๆ นอกเหนือจากนั้นในเว็บไซต์ของพวกเรานั้นก็จะมีเกมส์ต่างๆให้ลูกค้าได้เลือกเล่นกันอย่างมากไม่น้อยเลยทีเดียวอีกด้วย ทำให้ทุกคนที่เข้ามาเป็นสมาชิกกับ ยูฟ่าเบทนั้นก็ชื่นชอบกันเป็นอย่างมากนั่นเอง

    ตอนนี้นั้นการ lsm99เกมยิงปลา ถือเป็นเรื่องที่ธรรมดาไปแล้วนะครับ
    หลายๆคนก็เริ่มที่จะพอใจให้กับการเล่นการพนันออนไลน์กันมากมายแบบเดียวกัน เนื่องจากว่าเป็นการเล่นที่สนุก ได้เสี่ยงดวง ได้เงินดี ได้เงินจริง โดยครั้งก่อนนั้นการเล่นการพนันออนไลน์ผู้คนจำนวนไม่ใช้น้อยก็ถูกโกงกันมากมายเช่นเดียวกันครับผมทำให้ไม่กล้าที่จะเข้ามา เกมยิงปลาได้เงินจริง กันนั่นเองแต่ว่าขณะนี้นั้น ถ้าหากว่าคนไหนกันแน่ได้มาทดลองเล่นกับ
    ufabet ของพวกเรานั้นยืนยันได้เลยว่าทุกคนที่ได้มาเล่นจริงๆก็จะถูกใจกันอย่างแน่แท้นั่นเอง เนื่องจากว่าอย่างที่ทราบกันอยู่แล้วนะครับว่า เว็บของพวกเรานั้นก็พร้อมที่จะแจกโปรโมชั่นแล้วก็โบนัสต่างๆกันอย่างจัดเต็มจริงๆทำให้ทุกคนนั้นก็ชื่นชอบกันอย่างมากและกลับมาเล่นกับพวกเรากันทุกคราว

  25. Hello to every , since I am actually keen of reading this webpage’s post to be updated regularly.
    It carries pleasant stuff.

  26. The key reason anyone would ask in which question is because they have been billed with some form of DUI (driving under the
    influence) or DRUNK DRIVING (driving while intoxicated).
    If this sounds like you or a person you need to hire a lawyer as quickly as
    possible.

    There are several reason why you need a competent DUI lawyer working hard for yourself.
    Primarily they will know your legal rights in regard to the
    specific cost against you. Thus, sun’s rays able to help prevent you from
    self-incriminating yourself or any other faults you are likely to make.

    Moreover, if the charge is a serious 1, which hopefully it is not, they will know
    how to defend you in court. You need the experience of an excellent DUI lawyer because they discover how to talk to judges, juries and also the prosecution. And once again they
    will the actual law far more thoroughly you will, given their
    numerous years of legal experience.

    Probably the most frequent argument against hiring a DRIVING UNDER THE INFLUENCE lawyer is that they are expensive.

    Well this is a valid point a good DUI attorney is going to be high priced,
    but that is because of the worth they provide.
    For example , how much will you pay to avoid going to
    jail even for a few months. For many people the cost of the DUI lawyer when compared to the potential
    fines or jail time of not; find that hiring one is a good investment on their part.

  27. Excellent post. I used to be checking constantly this blog and I’m inspired!
    Extremely helpful information particularly the closing part :) I
    take care of such info a lot. I used to be looking for this certain information for a
    long time. Thanks and good luck.

  28. Have you ever asked yourself “can I watch motion pictures on the web?” Well you will certainly be surprised to recognize that the answer to that concern is “yes.” With today’s innovation it
    is extremely feasible to enjoy motion pictures online. How can one see unlimited films on the internet you ask?

    There are a pair ways to view films online; you can pay for subscription websites like Netflix, Blockbuster and some other ones that will certainly enable you to rent out DVD’s from them; however these techniques have their downside to watching flicks.
    You are actually not enjoying films online; you are
    instead renting movies from the business and also
    will have to return the motion picture prior to you will be able to get an additional.
    You will certainly receive the flicks of your selection through the mail.
    You will certainly not get the following movie of selection until you return the motion picture that you currently have.

  29. excellent issues altogether, you simply received a emblem new reader.
    What might you recommend in regards to your put up that you made
    a few days in the past? Any certain?

  30. ]올해 12월부터 5년 간 복권 사업을 총괄 운영하는 4기 복권수탁사업자 입찰이 마감됐다.
    입찰 결과 나눔로또, 인터파크, 동행복권
    등 3개 컨소시엄으로 압축된 가운데, 제주반도체가 주관하는 동행복권 컨소시엄은 공정성과 기술성을 앞세웠다.
    동행복권은 제주반도체(43.7%) 케이뱅크(1%) 에스넷시스템(12%) 등으로 컨소시엄을 꾸렸다.
    기존 사업자인 나눔로또, 높은 인지도의 인터파크에
    비해 상대적인 열세처럼 보이지만, 동행복권 측은
    “공정성·기술성 측면에서 타 컨소시엄에 확실한 경쟁우위를 확보하고 있다”며 자신감을 표출하고 있다.

    먼저 동행복권이 강조하고 있는 것은 ‘공정성’이다.
    동행복권 측은 “복권사업은 판매액 41%를 복지예산으로 쓰는 등 사행산업 중 공익기여도가 가장 높고 불법 중독성 도박을 줄이는 효과가 있다”며
    “복권수탁사업자가 공정성 논란이 빚어지면, 정부 입장에서는 사행성을 조장하고 사업자에게 초과 이익을 제공한다는 비난을 받을 수 있다”고 설명했다.
    이어 “동행복권은 금융 인프라 그룹 나이스 그룹의 ‘한국전자금융’, ‘KIS정보통신’과 ‘나이스페이먼츠’, 공영방송 MBC의 사회공헌기업 ‘MBC 나눔’이 주주로 참가했다”며 “신용평가, 사회공헌 등 공정성이 핵심경쟁력으로 꼽히는 업체들이 참여한 만큼, 동행복권은 공정하고 건전한 복권사업 운영에 적합하다”고 강조했다.
    또한 동행복권은 강점으로 ‘기술성’을 내세우고 있다.

    동행복권 측은 “전국 2만5천대 규모의 CD/ATM기를 운용하고 800여 명의 현금수송인력을 보유한 ‘한국전자금융’이 복권 유통구조를 혁신할 것”이라며
    “국산 온라인복권 개발업체인 ‘오이지 소프트’, 스포츠 토토 개발업체 ‘메타씨앤에스’ 등 국산화 복권시스템을 고도화시킬 역량을 확보했다”고
    설명했다. 이 밖에도 동행복권은 복권 컨설팅업체
    ‘챔피언시스템즈’와 협약을 체결해
    기술은 물론 운영 노하우 측면에서도 경쟁력이 있다고 자신하고 있다.
    일각에서는 동행복권이 이용 편의성이 떨어진다고 지적하고 있다.

    현재 동행복권 자금조달업체인 ‘K뱅크’는 인터넷 은행이기 때문에 복권당첨자가 당첨금액을 수령하기가 어렵다는
    것이다.

  31. Nonton film streaming subtitle Indonesia gratis download
    online.

  32. Magnificent goods from you, man. I’ve understand your stuff previous to and you’re just too excellent.
    I really like what you have acquired here, really like what you are saying and the way
    in which you say it. You make it entertaining and
    you still care for to keep it wise. I can’t wait to read much more from you.
    This is really a terrific site.

  33. Hi every one, here every one is sharing such knowledge, so it’s good to read this website, and I used to go to see this weblog everyday.

  34. Hi, I think your website might be having browser compatibility issues.
    When I look at your website in Ie, it looks fine but when opening
    in Internet Explorer, it has some overlapping. I just wanted to give you
    a quick heads up! Other then that, amazing blog!

  35. If some one wants to be updated with hottest technologies
    then he must be visit this web page and be up to date everyday.

  36. When some one searches for his required thing, so he/she desires to be available that in detail, so that thing is maintained
    over here.

  37. Hello, this weekend is good designed for me, as this time
    i am reading this great informative piece of writing here at my home.

  38. I’m excited to uncover this great site. I want to to thank you for ones time due
    to this fantastic read!! I definitely savored every little bit of it and
    i also have you bookmarked to check out new things on your blog.

  39. Hi, I think your site might be having browser compatibility issues.
    When I look at your blog site in Chrome, it looks fine but when opening in Internet
    Explorer, it has some overlapping. I just wanted to give you a
    quick heads up! Other then that, terrific blog!

  40. What’s up, yup this post is actually pleasant and I have learned lot of things from it concerning blogging.
    thanks.

  41. I have read so many content on the topic of the blogger lovers except this paragraph is actually a pleasant article, keep it
    up.

  42. Do you mind if I quote a few of your articles as long as I provide
    credit and sources back to your webpage? My website is in the exact same niche as yours and my visitors would truly benefit from a lot of the
    information you provide here. Please let me know if this alright with you.
    Many thanks!

  43. What’s up, yes this post is in fact good and I have learned lot of
    things from it about blogging. thanks.

  44. For latest information you have to go to see internet and
    on world-wide-web I found this web site as a most excellent web
    page for most up-to-date updates.

  45. First of all I want to say superb blog! I had a quick question in which I’d
    like to ask if you do not mind. I was interested
    to know how you center yourself and clear your
    head prior to writing. I have had a difficult time clearing my thoughts in getting my ideas out.
    I truly do take pleasure in writing however it just seems like the first 10 to 15 minutes
    tend to be lost simply just trying to figure out how to begin. Any recommendations or hints?
    Thank you!

  46. What’s up to every , as I am truly keen of reading this website’s post to
    be updated on a regular basis. It carries pleasant data.

  47. Hi there to every body, it’s my first go to see of this blog;
    this website carries amazing and truly good stuff in favor of readers.

  48. Hi, I wish for to subscribe for this website to obtain hottest
    updates, therefore where can i do it please help.

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2017 Toby's Epril Suffusion theme by Sayontan Sinha