java - how to get location from maven dependency's properties file? -


people,do know if possible properties file maven dependency? more preciselly, using spring 4, , have application.properties looking this:

logging.level.org.springframework.web: info logging.level.org.hibernate: error logging.level.com.example.movies: debug  spring.config.location=example-backend-development-domain/src/main/resources/application.properties 

this last line not working. want specify there application.properties file inside resources folder inside maven dependency (which has, way, same parent of actual project). so, dependency:

    <dependency>         <groupid>com.despegar.qc.example</groupid>         <artifactid>example-backend-development-domain</artifactid>     </dependency> 

do know if possible make spring.config.location line work? , in case, know way that? in advance!

you can't load property files logging configuration. instead, create bean tag in configuration file , use it.

<bean id="myproperties" class="org.springframework.beans.factory.config.propertiesfactorybean">   <property name="locations">     <list>       <value>classpath*:application.properties</value>     </list>   </property> </bean> 

and can use in either way:

@component class myclass {   @value("${propertyname}")   private string myvalue; } 

or

@component class myclass {   @resource(name="myproperties")   private properties myproperties;    @postconstruct   public void init() {     // whatever need properties   } } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -