Kitchen is a sample Spring Boot web application demonstrating the use of Feature Flags via Config Server for Tanzu Application Service. (For information on the Config Server product in Tanzu Application Service, please see the documentation.)
This project supports both Gradle and Maven build systems. It uses Spring Enterprise artifacts from Broadcom's repository, which requires authentication.
Kitchen imports the Tanzu Spring SDK BOM
(com.vmware.tanzu.spring:tanzu-spring-sdk-dependencies, version 1.2.0) in both builds. The BOM manages the version of the
Application Services starters, so the feature flag starter is declared without a version:
<!-- Maven -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vmware.tanzu.spring</groupId>
<artifactId>tanzu-spring-sdk-dependencies</artifactId>
<version>1.2.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>// Gradle
dependencyManagement {
imports {
mavenBom("com.vmware.tanzu.spring:tanzu-spring-sdk-dependencies:1.2.0")
}
}To use a different SDK release, change the BOM version in pom.xml and build.gradle.kts. Both files must stay in sync.
Your build must resolve artifacts from a repository that mirrors or proxies the Spring Enterprise Repository. See Spring Enterprise Repository for Artifact Repository Administrators.
Both Gradle and Maven can use these environment variables:
export SEC_ARTIFACTORY_USERNAME=your_username
export SEC_ARTIFACTORY_PASSWORD=your_access_tokenFor Gradle:
Gradle is automatically configured to use the environment variables above. Alternatively, you can add them to your ~/.gradle/gradle.properties file:
secArtifactoryUsername=your_username
secArtifactoryPassword=your_access_tokenFor Maven:
Maven requires you to add the spring-enterprise server to your ~/.m2/settings.xml file. The configuration below will read the environment variables you set in step 1:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>spring-enterprise</id>
<username>${env.SEC_ARTIFACTORY_USERNAME}</username>
<password>${env.SEC_ARTIFACTORY_PASSWORD}</password>
</server>
</servers>
</settings>./gradlew build
./gradlew bootRun# Using Maven wrapper (recommended)
./mvnw clean compile
./mvnw clean package
./mvnw spring-boot:run
# Or if you have Maven installed globally
mvn clean compile
mvn clean package
mvn spring-boot:runcf create-service p.config-server standard kitchen-config-server \
-c '{ "git": { "uri": "https://github.com/pivotal-cf/scs-public-config-repo" }}'Using Gradle:
./gradlew build && cf push -p build/libs/kitchen-0.0.1-SNAPSHOT.jarUsing Maven:
./mvnw clean package && cf push -p target/kitchen-0.0.1-SNAPSHOT.jarVisit your application route (e.g. https://kitchen.<your-app-domain>), and log in by providing a sample email address.
You may use the tester email addresses listed in the config repo to see the dishes that are only available for beta testers.
You can also enable dev profile and restart the app to verify that theme is changing to green.
cf set-env kitchen SPRING_PROFILES_ACTIVE dev && cf restart kitchen