Grails move data from application.properties -


application.propterty grails परियोजना के पर, मैं mobile.version = 1.0 हो गया। 0_0 ,

उसके बाद, मैं कनेक्ट और से प्रस्तुत करना प्रस्तुत करना (grailsApplication.metadata.'mobile.version ')

अब मैं 'ले जाने के लिए चाहते हैं mobive.version वेब एप्लिकेशन / वेब-INF / meta_data.properties करने के लिए।

मैं से कनेक्ट कर सकते meta_data.properties रेंडर करने के लिए mobile.version

मैं ज़रूरतमंद लोगों के लिए जवाब हो गया।

 < कोड> गुण configProps = नया गुण (); । डीईएफ़ absolutePath = grailsApplication.parentContext.getResource ( "वेब-INF") file.absolutePath डीईएफ़ सितम्बर = System.getProperty ( 'file.separator') यूआरएल यू = नया URL ( "फ़ाइल: $ {absolutePath} $ {सितम्बर} meta_data ।गुण"); InputStream ip = u.openStream (); configProps.load (आईपी); प्रस्तुत करना (configProps.'mobile.version ')    

मुझे पता है तुम अपने जवाब मिल गया है, लेकिन मैं इस संपत्ति को Config.groovy में डाल दिया था फिर इसे एक्सेस करने के लिए आपका कोड बस है:

  grailsApplication.config.mobile.version    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -