반응형
SMALL
package com.in28minutes.springboot.learnspringboot;
import java.lang.ModuleLayer.Controller;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;
import org.apache.tomcat.util.digester.ArrayStack;
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 {
// @RequestMapping("/JH")
// public List<Course> jHCourses(){
// return Arrays.asList(
// new Course(0, null, null),
// new Course(0, null, null)
// );
// }
@Autowired
private CurrencyServiceConfiguration configuration;
@RequestMapping("/currency-configuration") //"지정주소"
public CurrencyServiceConfiguration jhCourses(){
return configuration;
}
}
package com.in28minutes.springboot.learnspringboot;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
// currency-service.url =
// currency-service.username =
// currency-service.key =
@ConfigurationProperties(prefix = "currency-service")
@Component
public class CurrencyServiceConfiguration {
private String url;
private String username;
private String key;
//Setter
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=dev
currency-service.url = http://defaut.in28minutes.com
currency-service.username = defaultusername
currency-service.key = defaultkey
logging.level.org.springframework=trace
currency-service.url = http://dev.in28minutes.com
currency-service.username = devusername
currency-service.key = devkey
반응형
LIST
'Spring > Spring Boot' 카테고리의 다른 글
H2콘솔 및 테이블 생성 (0) | 2023.08.27 |
---|---|
spring-boot actuator 사용 (0) | 2023.08.27 |
로깅 방법, 종류 (0) | 2023.08.27 |
Spring Boot Davtools로 빠르게 빌드 (0) | 2023.08.27 |
API빌드 (0) | 2023.08.27 |