@Profile에 대해서 설명해주세요. #219
le2sky
started this conversation in
Spring Core
Replies: 2 comments
-
<사용 이유> 이를 통해 개발, 테스트, 운영 등 다양한 환경에 맞춰 애플리케이션의 동작을 다르게 구성할 수 있습니다. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@Configuration
public class Config {
@Bean
@Profile("development") // profile이 development인 경우 등록
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder()
.setType(EmbeddedDatabaseType.HSQL)
.addScript("classpath:com/bank/config/sql/schema.sql")
.addScript("classpath:com/bank/config/sql/test-data.sql")
.build();
}
} 프로필은 ApplicationContext에게 알려주거나, spring.profiles.active 프로퍼티, web.xml 등을 이용해서 설정 가능합니다. 통합 테스트 환경에서는 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
뭘까용
Beta Was this translation helpful? Give feedback.
All reactions