Code for [BAEL-455]
This commit is contained in:
parent
80f92e0742
commit
38a995658e
|
@ -1 +0,0 @@
|
|||
Subproject commit f9673ef0c11c51b327555aaca61ee196935f998b
|
|
@ -29,15 +29,7 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-rest</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
|
@ -45,6 +37,11 @@
|
|||
<artifactId>spring-cloud-starter-vault-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-vault-config-databases</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
@ -59,6 +56,10 @@
|
|||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
package org.baeldung.spring.cloud.vaultsample.domain;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Entity
|
||||
public class Account {
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
private String name;
|
||||
|
||||
@NotNull
|
||||
private Long branchId;
|
||||
|
||||
@NotNull
|
||||
private Long customerId;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getBranchId() {
|
||||
return branchId;
|
||||
}
|
||||
|
||||
public void setBranchId(Long branchId) {
|
||||
this.branchId = branchId;
|
||||
}
|
||||
|
||||
public Long getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public void setCustomerId(Long customerId) {
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package org.baeldung.spring.cloud.vaultsample.repository;
|
||||
|
||||
import org.baeldung.spring.cloud.vaultsample.domain.Account;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||
|
||||
@RepositoryRestResource(collectionResourceRel="accounts", path="accounts")
|
||||
public interface AccountRepository extends PagingAndSortingRepository<Account, Long> {
|
||||
|
||||
}
|
|
@ -7,7 +7,6 @@ spring:
|
|||
config:
|
||||
order: -10
|
||||
|
||||
token: b93d1b0d-15b5-f69e-d311-352a65fa7bc8
|
||||
ssl:
|
||||
trust-store: classpath:/vault.jks
|
||||
trust-store-password: changeit
|
||||
|
@ -17,13 +16,14 @@ spring:
|
|||
application-name: fakebank
|
||||
|
||||
kv:
|
||||
enabled: true
|
||||
enabled: false
|
||||
backend: kv
|
||||
application-name: fakebank
|
||||
|
||||
database:
|
||||
enabled: true
|
||||
role: fakebank-accounts-rw
|
||||
# backend: database
|
||||
# username-property: spring.datasource.username
|
||||
# password-property: spring.datasource.password
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.vault.annotation.VaultPropertySource;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
|
@ -26,11 +25,12 @@ public class VaultSampleApplicationLiveTest {
|
|||
@Autowired
|
||||
DataSource datasource;
|
||||
|
||||
|
||||
@Test
|
||||
public void whenGenericBackendEnabled_thenEnvHasAccessToVaultSecrets() {
|
||||
|
||||
String fooValue = env.getProperty("foo");
|
||||
assertEquals("bar", fooValue);
|
||||
assertEquals("test-bar", fooValue);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#spring.cloud.vault.token=b93d1b0d-15b5-f69e-d311-352a65fa7bc8
|
||||
spring.cloud.vault.token=b93d1b0d-15b5-f69e-d311-352a65fa7bc8
|
||||
|
||||
logging.level.org.springframework=INFO
|
Loading…
Reference in New Issue