Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 로컬 환경에서 DB 분리 제거 #682

Open
wants to merge 3 commits into
base: BE/dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package site.coduo.common.config.storage;

import java.util.HashMap;
import java.util.Map;

import javax.sql.DataSource;

Expand All @@ -10,9 +11,11 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy;

@Configuration
@Profile("test | prod")
public class DataSourceConfig {

@Bean
Expand All @@ -32,10 +35,10 @@ public DataSource slaveDataSource() {
@Bean
@DependsOn({"masterDataSource", "slaveDataSource"})
public DataSource routingDataSource() {
DataSourceRouter dataSourceRouter = new DataSourceRouter();
DataSource writeDataSource = masterDataSource();
DataSource readDataSource = slaveDataSource();
HashMap<Object, Object> dataSourceMap = new HashMap<>();
final DataSourceRouter dataSourceRouter = new DataSourceRouter();
final DataSource writeDataSource = masterDataSource();
final DataSource readDataSource = slaveDataSource();
final Map<Object, Object> dataSourceMap = new HashMap<>();
dataSourceMap.put(DataSourceRouter.MASTER_TAG, writeDataSource);
dataSourceMap.put(DataSourceRouter.SLAVE_TAG, readDataSource);

Expand All @@ -44,7 +47,7 @@ public DataSource routingDataSource() {

return dataSourceRouter;
}

@Bean
@Primary
@DependsOn({"routingDataSource"})
Expand Down
Loading