Spring cloud function on azure - How to pass spring.profiles.active

Viewed 443

While deploying spring cloud function to azure using maven, I am trying to set "spring.profiles.active=dev" as below in pom.xml -

<plugin>
                <groupId>com.microsoft.azure</groupId>
                <artifactId>azure-functions-maven-plugin</artifactId>
                <version>1.14.3</version>
                <configuration>
                    <resourceGroup>${functionResourceGroup}</resourceGroup>
                    <appName>${functionAppName}</appName>
                    <runtime>
                        <os>linux</os>
                    </runtime>
                    <region>southeastasia</region>
                    <appServicePlanName>appplan</appServicePlanName>
                    <disableAppInsights>true</disableAppInsights>
                    <appSettings>
                        <property>
                            <name>JAVA_OPTS</name>
                            <value>--spring.profiles.active=${spring.profiles.active}</value>
                        </property>
                        <property>
                            <name>WEBSITE_USE_PLACEHOLDER </name>
                            <value>0</value>
                        </property>
                    </appSettings>
                </configuration>
                <executions>
                    <execution>
                        <id>package-functions</id>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

After running below two commands -

mvn clean package -Dspring.profiles.active=dev
mvn azure-functions:deploy -Dspring.profiles.active=dev

I can see that the function is successfully deployed to Azure and I can see the correct value of JAVA_OPTS being set under Function App >> Configuration >> Application Settings

But the profile is not being applied correctly as property values are not being read according the expected profile (dev).

Is this the correct way to set spring.profiles.active?

1 Answers

It seems instead of JAVA_OPTS we should be using "languageWorkers__java__arguments" as the app setting name.

Related