반응형
SMALL
package com.in28minutes.springboot.learnspringboot;
import java.util.Arrays;
import java.util.List; // Import List class
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class CurrencyConfigurationController {
@Autowired
private CurrencyServiceConfigyration configyration;
@RequestMapping("/currency-configyration")
public CurrencyServiceConfigyration retrieveAllCourses(){
return configyration;
}
}
package com.in28minutes.springboot.learnspringboot;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "currency-service")
@Component
public class CurrencyServiceConfigyration {
//currency-service.url=
//currency-service.username=
//currency-service.key=
private String url;
private String username;
private String key;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
}
logging.level.org.springframework=debug
spring.profiles.active=trace
currency-service.url=http://default.in28minytes.com
currency-service.username=defaultusername
currency-service.key=defaultkey
반응형
LIST
'Spring > Spring Boot' 카테고리의 다른 글
h2 삽입, 조회, 삭제 (0) | 2023.09.19 |
---|---|
h2콘솔 실행하기 (0) | 2023.09.19 |
@RestController, @RequestMapping("/courses") (0) | 2023.09.19 |
trace, debug, info, warning, error, off (0) | 2023.09.19 |
devtools (0) | 2023.09.16 |