Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
shop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
shop
Commits
8d1cecdd
Commit
8d1cecdd
authored
Aug 27, 2019
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
升个版本号
parent
5d113dea
Pipeline
#162
canceled with stages
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
160 additions
and
160 deletions
+160
-160
DataSourceConfig.java
src/main/java/com/egolm/shop/config/DataSourceConfig.java
+42
-42
SolrGoodsController.java
...n/java/com/egolm/shop/controller/SolrGoodsController.java
+118
-118
No files found.
src/main/java/com/egolm/shop/config/DataSourceConfig.java
View file @
8d1cecdd
package
com
.
egolm
.
shop
.
config
;
package
com
.
egolm
.
shop
.
config
;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
import
org.springframework.boot.
autoconfigure.jdbc.DataSourceBuilder
;
import
org.springframework.boot.
context.properties.ConfigurationProperties
;
import
org.springframework.boot.
context.properties.ConfigurationProperties
;
import
org.springframework.boot.
jdbc.DataSourceBuilder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
org.springframework.transaction.PlatformTransactionManager
;
import
org.springframework.transaction.PlatformTransactionManager
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.dialect.MySqlDialect
;
import
com.egolm.common.jdbc.dialect.MySqlDialect
;
@Configuration
@Configuration
public
class
DataSourceConfig
{
public
class
DataSourceConfig
{
@Bean
@Bean
@Primary
@Primary
@ConfigurationProperties
(
prefix
=
"spring.datasource"
)
@ConfigurationProperties
(
prefix
=
"spring.datasource"
)
public
DataSource
getDataSource
()
{
public
DataSource
getDataSource
()
{
return
DataSourceBuilder
.
create
().
type
(
DruidDataSource
.
class
).
build
();
return
DataSourceBuilder
.
create
().
type
(
DruidDataSource
.
class
).
build
();
}
}
@Bean
@Bean
@Primary
@Primary
public
PlatformTransactionManager
getTransactionManager
(
DataSource
dataSource
)
{
public
PlatformTransactionManager
getTransactionManager
(
DataSource
dataSource
)
{
return
new
DataSourceTransactionManager
(
dataSource
);
return
new
DataSourceTransactionManager
(
dataSource
);
}
}
@Bean
@Bean
@Primary
@Primary
public
JdbcTemplate
getJdbcTemplate
(
DataSource
dataSource
)
{
public
JdbcTemplate
getJdbcTemplate
(
DataSource
dataSource
)
{
JdbcTemplate
jdbcTemplate
=
new
JdbcTemplate
();
JdbcTemplate
jdbcTemplate
=
new
JdbcTemplate
();
jdbcTemplate
.
setDataSource
(
dataSource
);
jdbcTemplate
.
setDataSource
(
dataSource
);
jdbcTemplate
.
setDialect
(
new
MySqlDialect
());
jdbcTemplate
.
setDialect
(
new
MySqlDialect
());
jdbcTemplate
.
setSql_level
(
3
);
jdbcTemplate
.
setSql_level
(
3
);
return
jdbcTemplate
;
return
jdbcTemplate
;
}
}
}
}
\ No newline at end of file
src/main/java/com/egolm/shop/controller/SolrGoodsController.java
View file @
8d1cecdd
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment