add
This commit is contained in:
@ -24,14 +24,17 @@ public class IpConfig {
|
||||
|
||||
@PostConstruct
|
||||
public void dbToCache() {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
ClassPathResource classPathResource = new ClassPathResource("ip2region.xdb");
|
||||
InputStream inputStream = classPathResource.getInputStream();
|
||||
inputStream = classPathResource.getInputStream();
|
||||
IpUtil.setSearcher(Searcher.newWithBuffer(IoUtil.read(inputStream).toByteArray()));
|
||||
log.info("加载IP离线库到内存成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("加载IP离线库到内存失败, 请联系管理员!");
|
||||
} finally {
|
||||
IoUtil.close(inputStream);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user