use of org.springframework.core.io.support.ResourcePatternResolver in project modesti by jlsalmon.
the class RequestParserFactoryTest method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(Thread.currentThread().getContextClassLoader());
Resource[] sheets = resolver.getResources("classpath:/sheets/**/*.xls*");
for (Resource sheet : sheets) {
RequestParserFactoryTest.sheets.put(sheet.getFilename(), sheet);
}
}
use of org.springframework.core.io.support.ResourcePatternResolver in project syndesis by syndesisio.
the class DataManager method loadData.
private void loadData() {
try {
final ResourcePatternResolver resolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
final Resource[] resources = resolver.getResources("classpath:/META-INF/syndesis/connector/*.json");
if (resources != null) {
ReadApiClientData reader = new ReadApiClientData(encryptionComponent);
for (Resource resource : resources) {
try (InputStream is = resource.getInputStream()) {
// Replace placeholders
final String text = reader.findAndReplaceTokens(StreamUtils.copyToString(is, StandardCharsets.UTF_8), System.getenv());
Connector connector = Json.reader().forType(Connector.class).readValue(text);
if (connector != null) {
LOGGER.info("Load connector: {} from resource: {}", connector.getId().orElse(""), resource.getURI());
store(connector, Connector.class);
}
}
}
}
} catch (FileNotFoundException ignored) {
// ignore
} catch (IOException e) {
throw new IllegalStateException("Cannot load connector from resources due to: " + e.getMessage(), e);
}
}
use of org.springframework.core.io.support.ResourcePatternResolver in project spring-cloud by Rogge666.
the class MybatisConfigurer method sqlSessionFactoryBean.
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setTypeAliasesPackage(ProjectConstant.MODEL_PACKAGE);
// 分页插件
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments", "true");
properties.setProperty("returnPageInfo", "check");
properties.setProperty("params", "count=countSql");
// 分页尺寸为0时查询所有纪录不再执行分页
properties.setProperty("pageSizeZero", "true");
pageHelper.setProperties(properties);
// 添加插件
bean.setPlugins(new Interceptor[] { pageHelper });
// 添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return bean.getObject();
}
use of org.springframework.core.io.support.ResourcePatternResolver in project spring-cloud by Rogge666.
the class MybatisConfigurer method sqlSessionFactoryBean.
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setTypeAliasesPackage(ProjectConstant.MODEL_PACKAGE);
// 分页插件
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments", "true");
properties.setProperty("returnPageInfo", "check");
properties.setProperty("params", "count=countSql");
// 分页尺寸为0时查询所有纪录不再执行分页
properties.setProperty("pageSizeZero", "true");
pageHelper.setProperties(properties);
// 添加插件
bean.setPlugins(new Interceptor[] { pageHelper });
// 添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return bean.getObject();
}
use of org.springframework.core.io.support.ResourcePatternResolver in project spring-cloud by Rogge666.
the class MybatisConfigurer method sqlSessionFactoryBean.
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setTypeAliasesPackage(ProjectConstant.MODEL_PACKAGE);
// 分页插件
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments", "true");
properties.setProperty("returnPageInfo", "check");
properties.setProperty("params", "count=countSql");
// 分页尺寸为0时查询所有纪录不再执行分页
properties.setProperty("pageSizeZero", "true");
pageHelper.setProperties(properties);
// 添加插件
bean.setPlugins(new Interceptor[] { pageHelper });
// 添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
bean.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return bean.getObject();
}
Aggregations