Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
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
liyuan
byit-myth-job
Commits
1ac2432b
Commit
1ac2432b
authored
Dec 18, 2019
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改变数据源DataSource的注入方式
parent
de01da4a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
29 deletions
+44
-29
DataSourceConf.java
...yth-admin/src/main/java/com/byit/conf/DataSourceConf.java
+0
-21
MythJobScheduler.java
...in-core/src/main/java/com/byit/conf/MythJobScheduler.java
+6
-8
JobFlowThread.java
...min-core/src/main/java/com/byit/thread/JobFlowThread.java
+37
-0
JobScheduleHelper.java
...core/src/main/java/com/byit/thread/JobScheduleHelper.java
+1
-0
No files found.
byit-myth-admin/src/main/java/com/byit/conf/DataSourceConf.java
deleted
100644 → 0
View file @
de01da4a
package
com
.
byit
.
conf
;
import
lombok.Data
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
javax.sql.DataSource
;
/**
* @program: byit-myth-job->DataSourceConf
* @description: TODO
* @author: huangfu
* @date: 2019/12/9 19:52
**/
@Data
@Component
(
"dataSourceConf"
)
public
class
DataSourceConf
{
@Resource
private
DataSource
dataSource
;
}
byit-myth-
admin
/src/main/java/com/byit/conf/MythJobScheduler.java
→
byit-myth-
core/myth-admin-core
/src/main/java/com/byit/conf/MythJobScheduler.java
View file @
1ac2432b
package
com
.
byit
.
conf
;
package
com
.
byit
.
conf
;
import
com.byit.thread.JobFlowThread
;
import
com.byit.thread.JobScheduleHelper
;
import
com.byit.thread.JobScheduleHelper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.DisposableBean
;
import
org.springframework.beans.factory.DisposableBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.DependsOn
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Service
;
import
javax.sql.DataSource
;
/**
/**
* @program: byit-myth-job->MythJobScheduler
* @program: byit-myth-job->MythJobScheduler
...
@@ -19,12 +16,11 @@ import javax.sql.DataSource;
...
@@ -19,12 +16,11 @@ import javax.sql.DataSource;
**/
**/
@Component
@Component
@Slf4j
@Slf4j
@DependsOn
(
"dataSourceConf"
)
public
class
MythJobScheduler
implements
InitializingBean
,
DisposableBean
{
public
class
MythJobScheduler
implements
InitializingBean
,
DisposableBean
{
@Autowired
@Autowired
DataSourceConf
dataSourceConf
;
@Autowired
private
JobScheduleHelper
jobScheduleHelper
;
private
JobScheduleHelper
jobScheduleHelper
;
@Autowired
private
JobFlowThread
jobFlowThread
;
/**
/**
* 销毁方法
* 销毁方法
* @throws Exception
* @throws Exception
...
@@ -40,8 +36,10 @@ public class MythJobScheduler implements InitializingBean, DisposableBean {
...
@@ -40,8 +36,10 @@ public class MythJobScheduler implements InitializingBean, DisposableBean {
*/
*/
@Override
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
public
void
afterPropertiesSet
()
throws
Exception
{
jobScheduleHelper
.
setDataSource
(
dataSourceConf
.
getDataSource
());
//启用扫描线程
//启用扫描线程
jobScheduleHelper
.
start
();
jobScheduleHelper
.
start
();
jobFlowThread
.
start
();
}
}
}
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/JobFlowThread.java
0 → 100644
View file @
1ac2432b
package
com
.
byit
.
thread
;
import
com.byit.service.FlowVersionService
;
import
com.byit.service.MythJobFlowService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.sql.DataSource
;
/**
* @program: byit-myth-job->JobFlowThread
* @description: 扫描任务流表,关联版本表 获取任务流信息!
* 将此工作流添加到执行记录表!将该工作流下的该版本所有节点添加到预读表!
* @author: huangfu
* @date: 2019/12/18 14:12
**/
@Slf4j
@Component
public
class
JobFlowThread
{
private
DataSource
dataSource
;
@Autowired
private
MythJobFlowService
mythJobFlowService
;
@Autowired
private
FlowVersionService
flowVersionService
;
@Autowired
public
void
setDataSource
(
DataSource
dataSource
)
{
this
.
dataSource
=
dataSource
;
}
public
void
start
(){
System
.
out
.
println
(
dataSource
+
"我是扫描工作流的!"
);
}
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/thread/JobScheduleHelper.java
View file @
1ac2432b
...
@@ -312,6 +312,7 @@ public class JobScheduleHelper{
...
@@ -312,6 +312,7 @@ public class JobScheduleHelper{
scheduleThread
.
start
();
scheduleThread
.
start
();
}
}
@Autowired
public
void
setDataSource
(
DataSource
dataSource
)
{
public
void
setDataSource
(
DataSource
dataSource
)
{
this
.
dataSource
=
dataSource
;
this
.
dataSource
=
dataSource
;
}
}
...
...
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