Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈文顺
discovery
Commits
e45482d4
Commit
e45482d4
authored
Jul 04, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构PluginContextAware
parent
8c91f503
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/context/PluginContextAware.java
+61
-0
No files found.
discovery-plugin-framework/src/main/java/com/nepxion/discovery/plugin/framework/context/PluginContextAware.java
View file @
e45482d4
...
...
@@ -9,20 +9,81 @@ package com.nepxion.discovery.plugin.framework.context;
* @version 1.0
*/
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.NoSuchBeanDefinitionException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.core.ResolvableType
;
import
org.springframework.core.env.Environment
;
import
com.nepxion.discovery.plugin.framework.constant.PluginConstant
;
public
class
PluginContextAware
implements
ApplicationContextAware
{
private
ApplicationContext
applicationContext
;
private
Environment
environment
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
{
this
.
applicationContext
=
applicationContext
;
this
.
environment
=
applicationContext
.
getEnvironment
();
}
public
Object
getBean
(
String
name
)
throws
BeansException
{
return
applicationContext
.
getBean
(
name
);
}
public
<
T
>
T
getBean
(
String
name
,
Class
<
T
>
requiredType
)
throws
BeansException
{
return
applicationContext
.
getBean
(
name
,
requiredType
);
}
public
Object
getBean
(
String
name
,
Object
...
args
)
throws
BeansException
{
return
applicationContext
.
getBean
(
name
,
args
);
}
public
<
T
>
T
getBean
(
Class
<
T
>
requiredType
)
throws
BeansException
{
return
applicationContext
.
getBean
(
requiredType
);
}
public
<
T
>
T
getBean
(
Class
<
T
>
requiredType
,
Object
...
args
)
throws
BeansException
{
return
applicationContext
.
getBean
(
requiredType
,
args
);
}
public
boolean
containsBean
(
String
name
)
{
return
applicationContext
.
containsBean
(
name
);
}
public
boolean
isSingleton
(
String
name
)
throws
NoSuchBeanDefinitionException
{
return
applicationContext
.
isSingleton
(
name
);
}
public
boolean
isPrototype
(
String
name
)
throws
NoSuchBeanDefinitionException
{
return
applicationContext
.
isPrototype
(
name
);
}
public
boolean
isTypeMatch
(
String
name
,
ResolvableType
typeToMatch
)
throws
NoSuchBeanDefinitionException
{
return
applicationContext
.
isTypeMatch
(
name
,
typeToMatch
);
}
public
boolean
isTypeMatch
(
String
name
,
Class
<?>
typeToMatch
)
throws
NoSuchBeanDefinitionException
{
return
applicationContext
.
isTypeMatch
(
name
,
typeToMatch
);
}
public
Class
<?>
getType
(
String
name
)
throws
NoSuchBeanDefinitionException
{
return
applicationContext
.
getType
(
name
);
}
public
String
[]
getAliases
(
String
name
)
{
return
applicationContext
.
getAliases
(
name
);
}
public
ApplicationContext
getApplicationContext
()
{
return
applicationContext
;
}
public
Environment
getEnvironment
()
{
return
environment
;
}
public
Boolean
isRegisterControlEnabled
()
{
return
isRegisterControlEnabled
(
environment
);
}
...
...
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