File tree Expand file tree Collapse file tree 4 files changed +33
-2
lines changed
java/com/example/simpleapi/controller Expand file tree Collapse file tree 4 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 1+ Subproject commit 231c59038194262c7898820f82043e676111c068
Original file line number Diff line number Diff line change 55 <parent >
66 <groupId >org.springframework.boot</groupId >
77 <artifactId >spring-boot-starter-parent</artifactId >
8- <version >2.6 .1</version >
8+ <version >3.1 .1</version >
99 <relativePath /> <!-- lookup parent from repository -->
1010 </parent >
1111 <groupId >com.example</groupId >
4545 <artifactId >spring-boot-starter-test</artifactId >
4646 <scope >test</scope >
4747 </dependency >
48+ <dependency >
49+ <groupId >org.springframework.cloud</groupId >
50+ <artifactId >spring-cloud-starter-vault-config</artifactId >
51+ <version >4.0.1</version >
52+ </dependency >
4853 </dependencies >
4954
5055 <build >
Original file line number Diff line number Diff line change 66import org .springframework .web .bind .annotation .GetMapping ;
77import org .springframework .web .bind .annotation .RequestMapping ;
88import org .springframework .web .bind .annotation .RestController ;
9+ import org .springframework .beans .factory .annotation .Value ;
910
1011import com .example .simpleapi .model .Simple ;
1112
1516@ RequestMapping ("/api" )
1617@ Slf4j
1718public class SimpleApiController {
19+ @ Value ("${password}" )
20+ private String password ;
21+
22+ @ Value ("${username}" )
23+ private String username ;
24+
1825 @ GetMapping ("/hello" )
1926 public String hello () throws Exception {
20-
2127 log .info ("==========simple-api hello world" );
2228 return "hello world!!!" ;
2329
@@ -42,4 +48,12 @@ public String version() {
4248
4349 }
4450
51+ @ GetMapping ("/vault" )
52+ public String vault () {
53+ log .info (username );
54+ log .info (password );
55+ return "username = " +username +"\n password = " +password ;
56+
57+ }
58+
4559}
Original file line number Diff line number Diff line change @@ -15,6 +15,17 @@ app-info:
1515 version : ' @project.version@'
1616 timestamp : ' @app.build.timestamp@'
1717
18+ spring.cloud.vault :
19+ uri : http://192.168.56.20:8200 # vault 서버 주소
20+ token : hvs.CAESIIDNVNLB9sjwVQH_xv7KlkpI1036DSRFhlZYi5yJ9yncGh4KHGh2cy5TSVRqaVB4WmpZSVZpZWRpbjBBVjJvam8 # vault token
21+ connection-timeout : 5000
22+ read-timeout : 15000
23+ kv :
24+ backend : board-secret
25+ default-context : simple-api
26+ application-name : simple-api
27+
28+ spring.config.import : vault://
1829
1930logging :
2031 level :
You can’t perform that action at this time.
0 commit comments