Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
熊鹏飞
/
xxljob220
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4cf65ebd
authored
Feb 24, 2017
by
xueli.xue
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
GLUE依赖注入逻辑优化,支持别名注入;from:shirokumacafe@github
parent
d95277df
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
README.md
xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueFactory.java
README.md
View file @
4cf65ebd
...
...
@@ -709,6 +709,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
-
5、升级数据库连接池c3p0版本;
-
6、执行器log4j配置优化,去除无效属性;
-
7、底层代码重构和逻辑优化以及CleanCode;
-
8、GLUE依赖注入逻辑优化,支持别名注入;
#### 规划中
...
...
xxl-job-core/src/main/java/com/xxl/job/core/glue/GlueFactory.java
View file @
4cf65ebd
...
...
@@ -8,6 +8,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.core.annotation.AnnotationUtils
;
...
...
@@ -76,14 +77,24 @@ public class GlueFactory implements ApplicationContextAware {
// with bean-id, bean could be found by both @Resource and @Autowired, or bean could only be found by @Autowired
if
(
AnnotationUtils
.
getAnnotation
(
field
,
Resource
.
class
)
!=
null
)
{
try
{
fieldBean
=
applicationContext
.
getBean
(
field
.
getName
());
Resource
resource
=
AnnotationUtils
.
getAnnotation
(
field
,
Resource
.
class
);
if
(
resource
.
name
()!=
null
&&
resource
.
name
().
length
()>
0
){
fieldBean
=
applicationContext
.
getBean
(
resource
.
name
());
}
else
{
fieldBean
=
applicationContext
.
getBean
(
field
.
getName
());
}
}
catch
(
Exception
e
)
{
}
if
(
fieldBean
==
null
)
{
fieldBean
=
applicationContext
.
getBean
(
field
.
getType
());
}
}
else
if
(
AnnotationUtils
.
getAnnotation
(
field
,
Autowired
.
class
)
!=
null
)
{
fieldBean
=
applicationContext
.
getBean
(
field
.
getType
());
Qualifier
qualifier
=
AnnotationUtils
.
getAnnotation
(
field
,
Qualifier
.
class
);
if
(
qualifier
!=
null
&&
qualifier
.
value
()!=
null
&&
qualifier
.
value
().
length
()>
0
)
{
fieldBean
=
applicationContext
.
getBean
(
qualifier
.
value
());
}
else
{
fieldBean
=
applicationContext
.
getBean
(
field
.
getType
());
}
}
if
(
fieldBean
!=
null
)
{
...
...
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