How to read properties file in spring mvc 3




















We have detected that you are using Adblock on your web browser. If the site is one you enjoy and visits frequently we encourage you to whitelist the site. Please disable adblock or simply disable your ad blocker only on www.

Share this article on. Share on Facebook Share. Share on Twitter Tweet. Share on Pinterest Share. Share on LinkedIn Share. Share on Digg Share. Send email Mail. Print Print. It is not reading the value of the property. Please make sure that the class that contains the Value annotation is annotated with Component or any of the other component stereotype annotations.

You can try the below code. Add this to servelt-context. Santosh Hegde Santosh Hegde 2, 8 8 gold badges 30 30 silver badges 46 46 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.

Linked Related I hope you do too. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. How to read values from properties file? Ask Question. Asked 9 years, 11 months ago. Active 10 months ago. Viewed k times.

Improve this question. This does not look like a properties file. If it is a properties file in the Java sense - yes. Otherwise it is a custom file format that needs to be treated different and you can't just use the lines as property values in Spring if they don't have a key.

Add a comment. Active Oldest Votes. Improve this answer. Null 1, 9 9 gold badges 26 26 silver badges 32 32 bronze badges. Hi mrembisz, Thanks for your reply. Edited as suggested by Ethan. Thanks for update, could not accept original edit, it was too late already. For the case where you are dealing with comma separated values perhaps consider what is being proposed here by using EL: stackoverflow.

How do we use aaa? And yes, you can print it except not in the constructor because constructor is executed before values are injected. Show 3 more comments. There are various ways to achieve the same. Assuming ds. Community Bot 1 1 1 silver badge. To use a PropertySourcesPlaceholderConfigurer you must normally set a location or resource otherwise you couldn't access a properties file.



0コメント

  • 1000 / 1000