Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
e3be4f1e
Commit
e3be4f1e
authored
Mar 12, 2020
by
杨锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
策略工厂bug修复。
parent
71d0292b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
VerifyStrategyFactory.java
...controller/middleoffice/common/VerifyStrategyFactory.java
+2
-5
ApplicationContextHolder.java
...ava/cn/quantgroup/xyqb/util/ApplicationContextHolder.java
+5
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/common/VerifyStrategyFactory.java
View file @
e3be4f1e
package
cn
.
quantgroup
.
xyqb
.
controller
.
middleoffice
.
common
;
import
org.springframework.web.context.ContextLoader
;
import
org.springframework.web.context.WebApplicationContext
;
import
cn.quantgroup.xyqb.util.ApplicationContextHolder
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -12,13 +11,11 @@ public class VerifyStrategyFactory {
static
{
//cache
WebApplicationContext
context
=
ContextLoader
.
getCurrentWebApplicationContext
();
Map
<
String
,
IVerifyStrategy
>
beansOfType
=
context
.
getBeansOfType
(
IVerifyStrategy
.
class
);
Map
<
String
,
IVerifyStrategy
>
beansOfType
=
ApplicationContextHolder
.
getBeansOfType
(
IVerifyStrategy
.
class
);
beansOfType
.
values
().
forEach
(
strategy
->
strategiesMap
.
put
(
strategy
.
strategyName
(),
strategy
));
}
public
static
IVerifyStrategy
get
(
VerifyTypeEnum
verifyTypeEnum
)
{
return
strategiesMap
.
get
(
verifyTypeEnum
);
}
}
src/main/java/cn/quantgroup/xyqb/util/ApplicationContextHolder.java
View file @
e3be4f1e
...
...
@@ -7,6 +7,8 @@ import org.springframework.context.ApplicationContext;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
/**
* Created by Miraculous on 15/7/12.
*/
...
...
@@ -120,4 +122,7 @@ public class ApplicationContextHolder implements ApplicationContextAware {
return
applicationContext
.
getAliases
(
name
);
}
public
static
<
T
>
Map
<
String
,
T
>
getBeansOfType
(
Class
<
T
>
requiredType
)
throws
BeansException
{
return
applicationContext
.
getBeansOfType
(
requiredType
);
}
}
\ No newline at end of file
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