Commit df432dca authored by Quxl's avatar Quxl

x

parent 6f110527
...@@ -2,7 +2,6 @@ package com.egolm.sso.config; ...@@ -2,7 +2,6 @@ package com.egolm.sso.config;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -38,19 +37,4 @@ public class DataSourceConfig { ...@@ -38,19 +37,4 @@ public class DataSourceConfig {
return jdbcTemplate; return jdbcTemplate;
} }
@Bean
@Qualifier("dataSource2")
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource getDataSource2() {
return DataSourceBuilder.create().type(DruidDataSource.class).build();
}
@Bean
@Qualifier("jdbcTemplate2")
public JdbcTemplate getJdbcTemplate2(@Qualifier("dataSource2")DataSource dataSource) {
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(dataSource);
return jdbcTemplate;
}
} }
\ No newline at end of file
...@@ -4,10 +4,11 @@ import java.text.MessageFormat; ...@@ -4,10 +4,11 @@ import java.text.MessageFormat;
import java.util.Map; import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.sso.config.XRException; import com.egolm.sso.config.XRException;
...@@ -15,9 +16,9 @@ import com.egolm.sso.config.XRException; ...@@ -15,9 +16,9 @@ import com.egolm.sso.config.XRException;
public class CommonService { public class CommonService {
@Autowired @Autowired
@Qualifier("jdbcTemplate2")
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Transactional(propagation=Propagation.NOT_SUPPORTED)
public Long getNextval(String sName) { public Long getNextval(String sName) {
try { try {
Map<String, Object> seqMap = jdbcTemplate.queryForMap("select * from x_sequence where name = ?", sName); Map<String, Object> seqMap = jdbcTemplate.queryForMap("select * from x_sequence where name = ?", sName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment