Created
April 28, 2020 06:46
-
-
Save CheolhoJeon/5fab3e8229250fad1bd425b65a6c0ddd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class MemberConfigWithProfile { | |
@Autowired | |
private DataSource dataSource; | |
@Bean | |
public MemberDao memberDao() { | |
return new MemberDao(dataSource); | |
} | |
@Configuration | |
@Profile("dev") | |
public static class DsDevConfig { | |
@Bean(destroyMethod = "close") | |
public DataSource dataSource() { | |
... | |
} | |
} | |
@Configuration | |
@Profile("real") | |
public static class DsRealConfig { | |
@Bean(destroyMethod = "close") | |
public DataSource dataSource() { | |
... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment