Configurations defined in custom properties file of Spring boot project via webmvc-config.xml are not reflecting for one project component

Viewed 134

I am using Spring boot version 1.5.2.. pretty old I know.

I have multiple project components which have the @SpringBootApplication annotation, so they run as separate apps. In all these apps, we have some custom config files, like this one named projectscopes.properties, in the webmvc-config.xml file -

<bean id="propertyConfigurer"
        class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
        <property name="ignoreResourceNotFound" value="true" />
        <property name="locations">
            <list>
                <value>classpath:/spring/application.properties</value>
                <value>classpath:/spring/local.properties</value>
                <value>classpath:/spring/netbankingapplication.properties</value>
                <value>classpath:/spring/projectscopes.properties</value>
                <value> file:${projectname.config.dir}/application.properties   </value>
                <value>file:${projectname.config.dir}/netbankingapplication.properties</value>
                <value>file:${projectname.config.dir}/projectscopes.properties</value>
            </list>
        </property>
    </bean>

    <bean id="configProperties"
        class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="ignoreResourceNotFound" value="true" />
        <property name="locations">
            <list>
                <value>classpath:/spring/application.properties</value>
                <value>classpath:/spring/local.properties</value>
                <value>classpath:/spring/netbankingapplication.properties</value>
                <value>classpath:/spring/projectscopes.properties</value>
                <value>file:${projectname.config.dir}/application.properties</value>
                <value>file:${projectname.config.dir}/netbankingapplication.properties
                </value>
                <value>file:${projectname.config.dir}/projectscopes.properties</value>
            </list>
        </property>
    </bean>

The projectname.config.dir is passed during spring-boot:run.

This file has definitions for all the API end points and define the oauth roles which can access those APIs -

service/some/path/user/details=prepaid_manager;ROLE_CITRUSPAY_MERCHANT_SUPERVISOR;

The problem

The changes done to projectscopes.properties of one of the projects seems to be not working. I commented out an existing API path and it continued to work. Also added a new, but the change is not reflecting.

Originally this API path was there -

service/some/path/user/details=project_manager;ROLE_PROJECT_MERCHANT_SUPERVISOR;

Now, I commented out it and added user/detailss -

#service/some/path/user/details=project_manager;ROLE_PROJECT_MERCHANT_SUPERVISOR;
service/some/path/user/detailss=project_manager;ROLE_PROJECT_MERCHANT_SUPERVISOR;

But still I am only able to access user/details. Latter throws this error -

{
    "timestamp": 1571753007447,
    "status": 404,
    "error": "Not Found",
    "message": "Not Found",
    "path": "/service/some/path/user/detailss"
}

I am not sure why is it not reading the changes to projectscopes.properties.

Changes made to application.properties seems to be working though. It has db configs defined.

I verified that I am making changes to the correct projectscopes.properties file.The config path given seems to be correct. When application starts up, I get the following -

spring-boot:run -Dprojectname.config.dir=/Users/sandeepan.nath/Desktop/codebase/root/prepaid/project-prepaid-internal-app/src/main/resources/spring/ ..

I am not sure what else to check.

1 Answers

Ah I got it. There was a wildcard entry in the projectscopes.properties -

service/some/path/**=project_manager;ROLE_CITRUSPAY_MERCHANT_SUPERVISOR;

And all the individual declarations are also present. Those were not cleaned up!

And code changes are not applying automatically. I am having to run clean install. I am using Intellij editor.

Related