Skip to content

Commit

Permalink
1. Update the property name. (#151)
Browse files Browse the repository at this point in the history
2. Fix error in README.md.
  • Loading branch information
rujche authored Jan 13, 2022
1 parent 3a88751 commit 2ee7e07
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ mvn clean spring-boot:run

Start the application, you will see logs like this:
```text
secretNameInKeyVault1: secret-value-1
secretNameInKeyVault2: secret-name-in-key-vault-2-value-2
secretNameInKeyVaultBoth: secret-value-1
sampleProperty1: key_vault_secret_01: sampleProperty1: value
sampleProperty2: key_vault_secret_02: sampleProperty2: value
samplePropertyInMultipleKeyVault: key_vault_secret_01: samplePropertyInMultipleKeyVault: value
```

We can see that property-source-1 have higher priority.
We can see that key_vault_secret_01 have higher priority.

## Clean Up Resources
After running the sample, if you don't want to run the sample, remember to destroy the Azure resources you created to avoid unnecessary billing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
@SpringBootApplication
public class SampleApplication implements CommandLineRunner {

@Value("${secret-name-in-key-vault-1}")
private String secretNameInKeyVault1;
@Value("${secret-name-in-key-vault-2}")
private String secretNameInKeyVault2;
@Value("${secret-name-in-key-vault-both}")
private String secretNameInKeyVaultBoth;
@Value("${sampleProperty1}")
private String sampleProperty1;
@Value("${sampleProperty2}")
private String sampleProperty2;
@Value("${samplePropertyInMultipleKeyVault}")
private String samplePropertyInMultipleKeyVault;

public static void main(String[] args) {
SpringApplication.run(SampleApplication.class, args);
}

public void run(String[] args) {
System.out.println("secretNameInKeyVault1: " + secretNameInKeyVault1);
System.out.println("secretNameInKeyVault2: " + secretNameInKeyVault2);
System.out.println("secretNameInKeyVaultBoth: " + secretNameInKeyVaultBoth);
System.out.println("sampleProperty1: " + sampleProperty1);
System.out.println("sampleProperty2: " + sampleProperty2);
System.out.println("samplePropertyInMultipleKeyVault: " + samplePropertyInMultipleKeyVault);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ resource "azurerm_key_vault" "kv_account_01" {
}

resource "azurerm_key_vault_secret" "key_vault_secret_01" {
name = "secret-name-in-key-vault-1"
value = "key_vault_secret_01: secret-name-in-key-vault-1: value"
name = "sampleProperty1"
value = "key_vault_secret_01: sampleProperty1: value"
key_vault_id = azurerm_key_vault.kv_account_01.id
}

resource "azurerm_key_vault_secret" "key_vault_secret_common_01" {
name = "secret-name-in-key-vault-both"
value = "key_vault_secret_common_01: secret-name-in-key-vault-both: value"
name = "samplePropertyInMultipleKeyVault"
value = "key_vault_secret_01: samplePropertyInMultipleKeyVault: value"
key_vault_id = azurerm_key_vault.kv_account_01.id
}

Expand Down Expand Up @@ -127,13 +127,13 @@ resource "azurerm_key_vault" "kv_account_02" {
}

resource "azurerm_key_vault_secret" "key_vault_secret_02" {
name = "secret-name-in-key-vault-2"
value = "key_vault_secret_02: secret-name-in-key-vault-2: value"
name = "sampleProperty2"
value = "key_vault_secret_02: sampleProperty2: value"
key_vault_id = azurerm_key_vault.kv_account_02.id
}

resource "azurerm_key_vault_secret" "key_vault_secret_common_02" {
name = "secret-name-in-key-vault-both"
value = "key_vault_secret_common_02: secret-name-in-key-vault-both: value"
name = "samplePropertyInMultipleKeyVault"
value = "key_vault_secret_02: samplePropertyInMultipleKeyVault: value"
key_vault_id = azurerm_key_vault.kv_account_02.id
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ mvn clean spring-boot:run
Start the application, you will see a log like this:

```text
property springDataSourceUrl in Azure Key Vault: this is a test value
sampleProperty: kv: sampleProperty: value
```

## Clean Up Resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
@SpringBootApplication
public class SampleApplication implements CommandLineRunner {

@Value("${spring-data-source-url}")
private String springDataSourceUrl;
@Value("${sampleProperty}")
private String sampleProperty;

public static void main(String[] args) {
SpringApplication.run(SampleApplication.class, args);
}

public void run(String[] args) {
System.out.println("property springDataSourceUrl in Azure Key Vault: " + springDataSourceUrl);
@Override
public void run(String... args) {
System.out.println("sampleProperty: " + sampleProperty);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ resource "azurerm_key_vault" "kv_account" {
}

resource "azurerm_key_vault_secret" "kv" {
name = "spring-data-source-url"
value = "this is a test value"
name = "sampleProperty"
value = "kv: sampleProperty: value"
key_vault_id = azurerm_key_vault.kv_account.id
}

0 comments on commit 2ee7e07

Please sign in to comment.