Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
e8d75c62
Commit
e8d75c62
authored
Aug 04, 2018
by
Junling Bu
Browse files
chore[litemall-core]: 删除没有用到的代码
parent
58fc87d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-core/src/main/java/org/linlinjava/litemall/core/util/YmlPropertyFactory.java
deleted
100644 → 0
View file @
58fc87d2
package
org.linlinjava.litemall.core.util
;
import
org.springframework.boot.env.PropertySourcesLoader
;
import
org.springframework.core.env.PropertySource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.support.EncodedResource
;
import
org.springframework.core.io.support.PropertySourceFactory
;
import
java.io.IOException
;
/**
* 某些情况下外部依赖导致 yaml 配置未能正确注入时,@PropertySource(value = {"classpath:application-wx.yaml"}, factory = YmlPropertyFactory.class) 手动注入配置文件
*/
public
class
YmlPropertyFactory
implements
PropertySourceFactory
{
@Override
public
PropertySource
<?>
createPropertySource
(
String
name
,
EncodedResource
resource
)
throws
IOException
{
return
name
!=
null
?
new
PropertySourcesLoader
().
load
(
resource
.
getResource
(),
name
,
null
)
:
new
PropertySourcesLoader
().
load
(
resource
.
getResource
(),
getNameForResource
(
resource
.
getResource
()),
null
);
}
private
static
String
getNameForResource
(
Resource
resource
)
{
String
name
=
resource
.
getDescription
();
if
(!
org
.
springframework
.
util
.
StringUtils
.
hasText
(
name
))
{
name
=
resource
.
getClass
().
getSimpleName
()
+
"@"
+
System
.
identityHashCode
(
resource
);
}
return
name
;
}
}
Write
Preview
Supports
Markdown
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