3.0에 추가된 SpEL의 활용방법은 매우 다양하다. SpEL을 사용하면 기존에 애용되던 ${}와 <context:property-placeholder>를 대체할 수도 있다.

${}로 property place holder를 만들어 두고 프로퍼티 파일을 읽어서 value를 바꿔치기 하는 방법은 환경에 따라서 자주 변하는 DB연결정보와 같은 설정정보를 XML이나 소스코드에서 분리시킬 수 있다는 장점이 있다. SRP에 따르면 responsibility, 즉 변하는 이유가 다르면 분리해야 한다. 설정 정보도 마찬가지다.

${} 방식의 단점은 프로퍼티 파일의 키 값에 ${ prefix와 } suffix를 붙여서 find-and-replace 방식으로 동작한다는 점이다. 매칭되는 키 값이 존재하지 않으면 ${} 부분이 그대로 남을 수 있다. 설정을 빼먹은 것이라면 모르겠지만 오타로 인해서 이름을 잘못 적거나 ${}을 제대로 넣지 않아도 경고 없이 그냥 넘어간다. 내부적으로는 BFPP에 의해서 동작하는 것이므로 ${}을 가진 빈 입장에서는 수동적이다. 남이 변경해주면 고맙고 아니어도 불평을 할 수 없다.

반면에 SpEL을 사용하는 방법은 능동적이다. SpEL로 property-placeholder를 대체하면 BFPP를 사용하지 않아도 된다. <util:properties>를 이용해서 프로퍼티 파일을 Properties 타입의 빈으로 생성하게 하고 다른 빈 오브젝트에 접근할 수 있는 SpEL을 이용해서 원하는 프로퍼티 값을 찾아오게 만들면 된다.

<util:properties id=”dbpr” location=”…” /> 이라고 되어있다면,

<property name=”username” value=”#{dbpr[‘username’]}” /> 으로 만들어주면된다. []는 Map 오브젝트의 get()을 호출해주는 SpEL의 표현이다.

SpEL은 능동적이다. 자기가 필요한 정보를 원하는 프로퍼티 정보를 담은 빈에 가서 직접 찾아오는 것이다. Properties빈이 존재하지 않으면 에러도 발생시켜준다. 물론 Map의 get()이라 키에 해당하는 값이 없어도 그냥 null이 들어간다는 한계는 있다. 수식을 좀 길게 쓰면 null인 경우에 오류가 발생하게 만드는 것도 가능할 것이다.

${}는 기존 설정의 호환성과 익숙한 방식의 집착 때문에라도 앞으로 오랜동안 사용될 것이다. context 스키마에서 직접 지원해주는 기능이기도 하고. 하지만 나는 SpEL을 사용하는 능동적인 방식으로 모두 바꿀 생각이다. 더 명시적이고, 구체적이고, 이해하기 쉽고, 오류도 잘 잡아주는 SpEL 방식이 더 맘에 들기 때문이다.

Related posts:

  1. Spring 3.0 EL (Spel)을 이용한 AssertThrows 확장 (3)
  2. Spring 3.0 EL (Spel)을 이용한 AssertThrows 확장 (2)
  3. Spring Expressions(SpEL)를 이용한 Mockito Argument Matcher 만들기
  4. Spring 3.0 EL (Spel)을 이용한 AssertThrows 확장 (1)
  5. 스프링 컨테이너에는 설정파일이 없다
  6. 톰캣 앞에 아파치 웹 서버(Httpd)를 두어야 할까?
  7. Maven archetype 설정파일 자동생성기 – ArchetypeXmlWriter
  8. 파이썬 완벽 가이드 전자책
  9. Spring 2.0의 XML확장기능 (1)
  10. 스프링 3.1 (7) 프로퍼티 소스 추상화와 PropertySourcePlaceholderConfigurer
  11. Inside Spring (5) PropertyPlaceholderConfigurer를 @Bean으로 정의해서는 안되는 이유
  12. Spring 3.0 (28) R-669 Update
  13. Spring 3.0 (52) 반쪽짜리 3.0 RC1 공개
  14. Spring 3.0 (36) Field Marker와 Field Default
  15. Spring 3.0 (2) R-518 스프링의 새 모듈 OXM(Object/XML Mapping)

Facebook comments:

to “Spring 3.0 (59) 프로퍼티 파일 이용하기 – placeholder vs SpEL”

  1. majestic baseball jersey.Our online shop will stock the entire range of majestic baseball jersey australia together with some fantastic discounted cheap jersey supply,it’s your pleasure to buy it with free shipping.

  2. Cubs 17 Kris Bryant White Strip New Cool Base Stitched MLB Jersey.Where
    to order purple baseball jersey?
    Collect Islanders 91 John Tavares Stitched Light Blue NHL
    Jersey varous sizes, which is crazy fashion now.

  3. I see you don’t monetize your page, don’t waste your traffic, you can earn extra
    bucks every month because you’ve got hi quality content.
    If you want to know how to make extra $$$, search for: Mertiso’s tips best
    adsense alternative

  4. I have checked your page and i’ve found some duplicate content, that’s why you don’t rank
    high in google’s search results, but there is a
    tool that can help you to create 100% unique content, search for; Boorfe’s tips unlimited content

  5. Hi I really enjoyed reading this content

  6. Nike Cowboys 82 Jason Witten White Mens Stitched NFL Elite Jersey.Nike Cowboys 82 Jason Witten White Mens
    Stitched NFL Elite Jersey-Welcome to buy cheap wholesale Nike Vikings 19 Adam Thielen Purple Team Color Mens Stitched NFL Elite
    Jersey with free shipping and best service in our jerseys online shop.

  7. You could make use of the discount rate code HostingTavern”
    best rated canister vacuum for pet hair – Ada – $50 off if you make a decision to purchase as well as utilize along side GSA.

  8. I have checked your page and i have found some
    duplicate content, that’s why you don’t rank high in google,
    but there is a tool that can help you to create
    100% unique content, search for; Best article rewritwer Ercannou’s essential tools

  9. Dress Elegantly
    When purchasing a property you are able to lessen your house owner’s insurance amount by purchasing a home around a fireplace office. The better you are, the more reward you will definitely get and for that reason the higher discount on the rates. Don’t forget to place flame extinguishers all around your home for even more security.
    Sleeping much more up-right. Increasing your upper body can alleviate equally gravity and strain, allowing you to have a complete night’s relax without the need of heavy snoring. Use pillows or place some bricks within the headboard. Just a slight height can stop you from heavy snoring, so give it a try to see what level works for you.
    Nike Air Huarache Womens
    To perform properly in currency trading, you have to review the essential methods of marketplace assessment. It can be difficult to do well in forex trading should you not use a strong understanding of the guidelines in the approach. Knowing industry assessment will help you to make informed and rewarding selections.

  10. Masteron Hair Loss Permanent
    While using tips and tricks that you’ve just read through, you can allow yourself a great head start in developing a imaginative and different photography profile. This knowledge will allow you to as you may create your talent in portraiture, landscape digital photography, sports activities and measures pictures, and even macro photos that give you in close proximity and private together with your subject matter.Superb Style Ideas That The Experts Use
    Anadrol Natural Alternative
    Since you now have an idea concerning how to increase your appearance you need to start to sense confident about you yet again. Lots of people don’t know the significance of establishing a great appearance for their own reasons, and they undergo existence never ever subsequent trends. However you can demonstrate individuals you already know excellent design after today.Earn The Battle In opposition to Depressive disorders Using These Helpful Tips
    Anavar Risks
    The greatest thing an pregnant mother can do for her unborn child’s wellness is always to give up smoking. A mum-to-be ought to talk with her physician or midwife for help and support. If you fail to give up, trim down! Research has revealed that women that are expectant and you should not quit, should attempt to restrict their selves to 5 tobacco per day. Even unless you give up, carry on and keep to the other instructions provided to you by the doctor, for example taking nutritional supplements and consuming sensibly.
    Dianabol Keifei 10mg

  11. Testosterone Cypionate Levels Chart
    If you are stressed out, you might sense not comfortable about sharing your issues with others. However, conversing freely about how you feel is important to experiencing better. Reports have confirmed that speaking with friends and family regarding your life will raise the responsibility that you might sense. Conversing it out can help you approach your thinking and figure out emotions which you failed to recognize right up until spoke regarding this out noisy.
    Winstrol R$
    In case your mortgage is at difficulty, do something to refinance as quickly as possible. While the case was previously that you may not rebuild a home loan until you possessed defaulted onto it, right now there are lots of steps it is possible to get just before hitting that point. This kind of financial triage is quite valuable, and can decrease the pain sensation of any house loan crisis.
    It seems goofy to advocate retaining your garden equipment nice and clean. It can be grime after all, but the dirt on your own equipment can harbour harmful bacteria and microbes that may infect your plants and flowers with sickness. Also the dampness in the earth could corrosion your tools prior to it dries out out. Wash them following every use and dried out them effectively to avoid corrosion.
    Methandienone Bayer Fake

  12. Testosterone Enanthate 1st Cycle
    Always keep a couple of things in your space or condo that happen to be wholesome, cheap as well as simple to consume. This will likely considerably minimize late-night fastfood works and can save you dollars because of this. Peanut butter, low fat yogurt and bagels are all excellent alternatives. In addition they do not have several unhealthy calories as fried chicken breast or hamburgers.
    Best Oral Steroids To Keep Gains
    Journey could be a wondrous experience. No definitely, it could be. With regards to touring to a different place and going through new people, traditions, and foods, it is genuinely anything of wonder. To begin studying some basic principles with regards to steps to make a strategy that works for you, reference the tips below.
    Anadrol 50 Side Effects
    Take far better care of your health. Despression symptoms is actually a indicate small devil plus it can make people forget the way to take better care of themselves and their well being. Depression also masks other thoughts, for example nervousness or anxiety, and discouraged folks may find their selves staying up later to the nighttime, simply to begin the following day sensing far worse. If you discover this is going on to you, set and maintain typical bedtimes. When you have sleep problems, exercise relaxation methods, including visualization or self-hypnosis, whilst in your bed.
    Tren 100 Reviews

  13. Master Kishan
    A few of the medicine that may be recommended to elderly people can cause persistent constipation. Two types of this type of treatment are diuretics and iron health supplements. You are able to take pro-lively steps to overcome this bowel irregularity. First of all, ingest at the very least seven servings of normal water daily. This will likely promote far better digestive operations. Also have far more fruits, fresh vegetables and cereals in your diet plans. These fiber content-unique foods support promote bowel regularity.
    Testosterone Enanthate Female
    An essential website marketing suggestion is usually to begin a blog that is certainly personalized to your website’s viewers. Retaining an up to date, useful website will allow you to connect with your viewers on a much deeper degree, providing them with understanding of your thoughts, likes and dislikes. This interconnection can help create a have confidence in using the market that can show helpful to your web marketing and advertising initiatives.
    Oxymetholone Drug Test
    Mildew is a very common allergen within several residences. It can be lowered by generally drying out all types of surface from the bathroom and kitchen after use. Fungus requires drinking water to develop, of course, if all surface areas are free of moisture, the mold are not able to grow. Also seem under your basins to be certain there are actually no spills which may permit mold to grow.
    Deca Durabolin Nuspojave

  14. Dianabol 5
    Here is the best position for plumbing related ideas. You could potentially appear significantly and wide but you simply will not discover ideas at the same time composed and crystal clear as what you should find here. Take advantage of this article today if you wish to know all of that you must know about plumbing related plus your house.
    Testosterone Propionate Fat Loss
    Avoid picture weighty sites so that you can keep rich in the search rankings. The motors get ranked text message higher compared to they do graphics if you are concentrating on graphics the standing for your personal internet site will be affected. What ever pictures you do include, make certain they involve alt written text that represents the photo.
    Equipoise For Dogs
    Prior to agreeing to a medical insurance plan, be sure to investigate about the provider you intend on getting insurance plan from. Even though an insurance policy might appear to be the best value, you would like to ensure that the supplier is not really at risk of moving bankrupt, includes a track record of great customer satisfaction, and may not trouble over genuine promises. In case a disaster ever happens, the final thing you can expect to want in your thoughts is a problem together with your insurance provider.
    Buy Injectable Steroids With Paypal

  15. Winstrol 40mg A Day
    With search engine optimization, nicely written content is important. Aside from upping your search engine ranking positions and website traffic, furthermore, it engages your reader and improves the chance of quality back links type other websites. Be sure your articles has correct spelling and grammar. Information which can be riddled with problems will provide your web site an not professional image. Not merely will website visitors feel your site appearance less than professional, you will also be not as likely to get high quality hyperlinks from authoritative web pages.
    Testosterone Propionate Chemical Name
    Use others for example guest loudspeakers on your site and then in your video clips. As exciting as you may be, your audiences will definitely value seeing a clean new deal with. Be sure that anyone who you possess inside your video tutorials displays the kind of information you wish to send to your visitors.
    Equipoise Insomnia
    Focus on competitors’ blogs and forums, and ensure you are undertaking what you could, in order to continue to be ahead of the video game. Search for new revolutionary ways to weblog according to your goal market. Make sure you do not let competition or any other people to version one of your articles, both.
    Oral Steroids Not Liver Toxic

  16. Turinabol Cycle
    Acquire Vitamins. A Ascorbic Acid nutritional supplement with bioflavonoids can be a all-natural antihistamine which helps to boost the body’s immune system. If you suffer from from the coughing or runny nostrils, you can decrease the soreness through taking a Vit A nutritional supplement. Vitamin E is a vital source of anti-oxidants, neutralizing the free-radicals that could boost allergic reactions.
    Injectable Steroids Uk
    In the event you allow it to, asthma attack can have a main impact on your daily life. You may get again your daily life using the sound guidance in the post over to relieve signs or symptoms and manage your bronchial asthma.Get Cooking food By Using The Following Tips
    Turinabol 4 Chlorodehydromethyltestosterone
    When you are having problems determining the very best diet regime to regulate your diabetes mellitus, seek advice from an authorized dietician (RD). She can help you create a diet regime to keep your blood glucose levels as standard as you possibly can. She is also a great useful resource for researching healthy foods and food preparation generally.
    Mesterolone Usage

  17. Oral Steroids Psoriasis Treatment
    Rice is an excellent carbohydrate and incredibly low-cost. Noodles and a loaf of bread are three times as much for every lb than rice. Buying a rice cooker is definitely worth it. Use rice when you would orzo or any other quick pastas.
    Equipoise Veterinary Supplies
    Tend not to utilize a brush on wet locks. Utilizing a brush on head of hair which is drenched subject areas the hair to breakage. As opposed to by using a remember to brush on the your hair when it’s drenched, use a hair comb to detangle it. The hair will suffer from significantly less breakage than when you used a clean.
    Testosterone Propionate Cycle Length
    Should you be food preparation pastries or food items that could get very untidy, be sure that you use an apron constantly. The worst thing that you will want to do is to get foods on your own outfits and also have to alter before you try to eat your meal with friends.
    Anadrol Mg Per Day

  18. Oral Steroids For Ms
    Look into and examine each and every bit of information regarding the professional real estate property building you are planning to put money into. You are looking into this residence to help you succeed in you company affairs. Don’t be lackadaisical when confronted with this info. If you are sloppy, you may end up paying for it in the end.
    Winstrol Kuur
    Among the very first directions your dog need to learn is always to appear when he is called by his title. To get started on receiving him employed to his brand, make use of it really as soon as he joins your family. Whenever he comes compliments him so he will discover adhering to orders a confident experience.
    Oral Steroids And Liver Damage
    By no means search for a dental professional simply because these people have a showy professional. Gimmicks that way are why terrible dental practices frequently make quite a lot of funds. Do your research so you know that the main one you decide on may be worth the cash. On the internet evaluations are a fun way to make a decision regardless of whether a new dental practitioner will be worth a pay a visit to.
    Twisted Equipoise Jewelry

  19. Testosterone Enanthate Beginner Cycle
    Before you start buying and selling, make sure to come with an purchase technique in your mind. A lot of people leap into forex trading ft . initially, and wind up dropping their tee shirt. Do your research, have got a created prepare of conditions that will make you acquire and then sell on, and follow it. Don’t acquire then sell on a whim.
    Testosterone Enanthate Jaki
    Handling stress and anxiety well before it paralyzes your steps is the simplest way to take care of these thoughts. If each and every condition is fixed with because it comes up, the worries might be released along with an nervousness invasion may be prevented. Believe calmly concerning the circumstance and choose the very best strategy.
    Equipoise Kick In Time
    Ensure that the name for every single of your respective pages is different. You also want to restrict the size of the name to approximately 70 figures. This can ensure that you only use the best keywords in the name, and you’re not creating excessively prolonged titles that detract from your Search engine optimization search positions.
    Tren Ace 75

  20. Testosterone Cypionate 250
    One important thing that you need to consider, for those who have plenty of nervousness or anxiety, is definitely the garments that you dress in. Ensure your clothes are secure and they will not fit way too small on the body. Unpleasant clothes can bring about a negative mental answer, yielding stress and panic.
    Chlorodehydromethyltestosterone Reviews
    Provide your body the ideal chance at muscle development bulk by doing exercises for your supreme amount of tiredness. Make sure that when you quit, you undoubtedly are not able to do even another repetition. This may most properly split your own muscles lower, causing your system to be effective tougher to build them back once more, and leading to the ripped muscle tissues that you are looking for.
    Dianabol Or Deca
    Except if you had been born perfect, you want a very little assistance occasionally to search much better, and also, save money time and money doing the work! With any luck ,, this information has provided you some beneficial insights on increasing your visual appeal which will work great for you against your own house. You will additionally have a far better picture of yourself plus a far more beneficial perspective on how wonderful you can really be!The Ideal Way To Handle Your Personal Financial
    Sustanon 250 And Anavar

  21. This web site can be a stroll-by way of for all the information you needed about this and didn’t know who to ask. Glimpse here, and also you’ll positively uncover it.

  22. After research a number of of the blog posts on your website now, and I actually like your way of blogging. I bookmarked it to my bookmark website record and will probably be checking back soon. Pls check out my site as effectively and let me know what you think.

  23. cialis generico
    When people begin thinking of abilities they need to learn or or learn more about, something that generally comes up is cooking. If this looks like you, you then came off to the right position. This short article will allow you to on your own journey to being a cook.
    viagra generico
    In the perspective of search engine optimization, use graphics sparingly. Internet search engine spiders are incapable of reading visuals. Graphics that you simply involves in your web pages must be connected to your site’s function. To enhance the Search engine marketing effect of your JPEGs and low-written text data files on the internet pages, you should use ALT tags and name tags which integrate correct key phrases.
    viagra original
    For those who have experienced your baby getting around within your belly, and then the movements halts for a few days, you must see your doctor. Even if this may indicate nothing at all, there might be an issue with the baby that the medical doctor will help repair if looked after over time.
    levitra 20

  24. cialis ireland
    Take some time and extremely go over what your insurance deductibles are prior to buying your policy. Should you be in an incident as well as your insurance deductibles are too higher, you can have an important from wallet expense prior to the insurance plan will begin to include you. Make sure they are as low as you can pay for.
    Kamagra Portugal
    Generally, you can expect to pick up unfavorable reasons for having surgical treatment. Regardless of whether it’s just a common viewpoint, or possibly a narrative about a process removed improper, the negative part of surgical treatment would seem to visit light. The truth is, when completed completely wrong, surgical treatment may be horrible, but once done properly, it may be a very beneficial treatment. And discover out how to get cosmetic plastic surgery done correctly, read the pursuing article.
    viagra preço
    Fully grasp and familiarize yourself with the digital camera. Even if this seems basic, many people have never ever even browse the guidelines on the way to run their camera. Get acquainted with and understand the various menus and operations of each and every button on it to ensure when you need to use a certain work, you already know where to find it and that your camera can accomplish it.
    viagra generico

  25. cialis senza ricetta
    You must discover ways to utilize your apple iphone to obtain guidelines to just about anywhere that you might want to look. You just need the map’s software, and you can select your vacation spot and starting point to get the directions you need. It is very simple and easy is virtually generally correct.
    Levitra original
    Urban and suburban traders in business real estate property think no more than what exactly is apparent to them on his or her everyday travels, including condominiums, offices and retail store properties. What don’t you see each day? Business components are away from view typically, yet still will need owners and renters, as do mobile house park systems, undeveloped items of territory and even properties of worship at times. Discover neighborhood niches that are a bit rare or out of vision for markets with hardly any competitors.
    kamagra gel
    Understand your amount of major depression. Major depression could be defined in several progressions, from mild to extreme clinical depression. Mild to moderate major depression has an effect on huge numbers of people, several of who don’t actually fully grasp that they are depressed. A mild kind can be defined as ‘the blues’ or feeling a little bit downward, in contrast to modest despression symptoms starts to have an effect on your daily life. Scientific despression symptoms is really severe that someone will lose curiosity about the outside community and experiences actions adjustments. It is important to talk about how you feel together with your doctor or counselor.
    levitra kopen

  26. priligy goedkoop
    Apnea is a kind of cause of snoring loudly and may cause serious health issues. Should you aren’t positive when you have this disorder, request your spouse or companion to observe you whilst you sleeping to find out if you snore loudly extremely and select long stretches without respiration, or you gasp for air. If you do, alert your personal doctor who may help you get a prognosis and remedy.
    kamagra jelly
    Sometimes songs treatment method has worked nicely to relieve back discomfort. Back problems can be associated with tension and pressure, seated back again and paying attention to tunes for a short period of time daily can decrease your worries and could work to assist your discomfort also. Unwind, hear your preferred songs, and minimize your lower back pain by undertaking the things you really like.
    Levitra original
    Major depression is a emotional health issues that outcomes a lot of people. It is aware of no race, grow older, religion, it is not biased, it might result any person. Often it’s challenging to reach out for aid, but there are numerous treatment methods offered to treat despression symptoms. This article will present you with some suggestions for finding a therapy that suits you.
    cialis ireland

Leave a Reply



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