当前位置: 首页>>代码示例>>Java>>正文


Java PathMatchingResourcePatternResolver类代码示例

本文整理汇总了Java中org.springframework.core.io.support.PathMatchingResourcePatternResolver的典型用法代码示例。如果您正苦于以下问题:Java PathMatchingResourcePatternResolver类的具体用法?Java PathMatchingResourcePatternResolver怎么用?Java PathMatchingResourcePatternResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PathMatchingResourcePatternResolver类属于org.springframework.core.io.support包,在下文中一共展示了PathMatchingResourcePatternResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: businessSqlSessionFactory

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
@Bean
@Primary
public SqlSessionFactory businessSqlSessionFactory(@Qualifier("businessDataSource") DruidDataSource businessDataSource) throws Exception {
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(businessDataSource);
    //mybatis分页
    PageHelper pageHelper = new PageHelper();
    Properties props = new Properties();
    props.setProperty("dialect", "mysql");
    props.setProperty("reasonable", "true");
    props.setProperty("supportMethodsArguments", "true");
    props.setProperty("returnPageInfo", "check");
    props.setProperty("params", "count=countSql");
    pageHelper.setProperties(props);
    //添加插件
    sqlSessionFactoryBean.setPlugins(new Interceptor[]{pageHelper});
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    sqlSessionFactoryBean.setMapperLocations(resolver.getResources(MAPPERXML_LOCATION));
    return sqlSessionFactoryBean.getObject();
}
 
开发者ID:DomKing,项目名称:busi-support,代码行数:21,代码来源:BusinessDatabaseConfig.java

示例2: body

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
private String body(String template, String language, Map<String, String> args) {
    final String templateFile = EMAIL_FILE.replace("*", template);

    try {
        return Files.lines(Paths.get(
            new PathMatchingResourcePatternResolver()
                .getResource(templateFile)
                .getURI()
        )).map(line -> text.format(line, language, args))
            .collect(joining("\n"));
    } catch (final IOException ex) {
        throw new IllegalArgumentException(
            "Could not find email template '" + templateFile + "'."
        );
    }
}
 
开发者ID:membaza,项目名称:users-service,代码行数:17,代码来源:EmailServiceImpl.java

示例3: parseLanguageFiles

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
private Map<String, Map<String, String>> parseLanguageFiles() {
    try {
        return Stream.of(
            new PathMatchingResourcePatternResolver()
                .getResources(MESSAGES_FILE)
        ).collect(toMap(
            this::parseLanguageName,
            this::parseLanguageFile
        ));
    } catch (final IOException ex) {
        throw new RuntimeException(
            "Error loading resourced by pattern '" +
            MESSAGES_FILE + "'.", ex
        );
    }
}
 
开发者ID:membaza,项目名称:users-service,代码行数:17,代码来源:TextServiceImpl.java

示例4: getMaps

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
public static List<String> getMaps() {
  List<String> maps = new ArrayList<>();
  ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
  try {
    Resource[] resources = resolver.getResources("maps/*.yaml");
    Arrays.stream(resources).map(Resource::getFilename).map(f -> f.replace(".yaml", ""))
        .filter(s -> !s.equals("defaults"))
        .forEach(maps::add);
  } catch (IOException e) {
    e.printStackTrace();
  }
  File[] localYamls = new File(".").listFiles(
      (dir, name) -> name.toLowerCase().endsWith(".yaml")
  );
  Arrays.stream(localYamls).forEach(f -> maps.add(f.getName().replace(".yaml", "")));

  return maps;
}
 
开发者ID:sinaa,项目名称:train-simulator,代码行数:19,代码来源:MapBuilderHelper.java

示例5: sqlSessionFactory

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public SqlSessionFactory sqlSessionFactory() throws Exception {
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(roundRobinDataSouceProxy());
    sqlSessionFactoryBean.setTypeAliasesPackage(this.typeAliasesPackage);
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    sqlSessionFactoryBean.setMapperLocations(resolver.getResources(this.mapperLocations));
    sqlSessionFactoryBean.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
    return sqlSessionFactoryBean.getObject();
}
 
开发者ID:jinping125,项目名称:read-write-sever,代码行数:12,代码来源:MybatisConfig.java

示例6: processEngineConfiguration

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
@Bean
public ProcessEngineConfigurationImpl processEngineConfiguration() throws IOException {
    SpringProcessEngineConfiguration config = new SpringProcessEngineConfiguration();
    config.setDataSource(dataSource());
    config.setTransactionManager(transactionManager());
    config.setDatabaseSchemaUpdate("true");
    config.setJobExecutorActivate(true);
    config.setAuthorizationEnabled(true);
    config.setDefaultSerializationFormat("application/json");
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    config.setDeploymentResources(resolver.getResources("classpath:/bpmn/*.bpmn"));
    List<ProcessEnginePlugin> processEnginePlugins = new ArrayList<>();
    SpinProcessEnginePlugin spinProcessEnginePlugin = new SpinProcessEnginePlugin();
    processEnginePlugins.add(spinProcessEnginePlugin);
    processEnginePlugins.add(CamundaReactor.plugin());
    config.setProcessEnginePlugins(processEnginePlugins);
    return config;
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:19,代码来源:Config.java

示例7: validateResource

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
public static void validateResource(String resourcePath,Logger log) 
{ 

	ResourcePatternResolver resourceResolver = new PathMatchingResourcePatternResolver();
	try {
		if (resourceResolver.getResources("classpath*:/GameData" +resourcePath+"*").length==0)
			log.error("INEXISTENT RESOURCE "+"/GameData" +resourcePath+"*");
	} catch (IOException e) {
		// TODO Auto-generated catch block 
		e.printStackTrace();
	}
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:13,代码来源:ResourceHelper.java

示例8: getConfig

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
public Properties getConfig(ConfigurableEnvironment env) throws IOException {
    PropertiesFactoryBean config = new PropertiesFactoryBean();
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    List<Resource> resouceList = InstanceUtil.newArrayList();
    try {
        Resource[] resources = resolver.getResources("classpath*:config/*.properties");
        for (Resource resource : resources) {
            resouceList.add(resource);
        }
    } catch (Exception e) {
        logger.error("", e);
    }
    config.setLocations(resouceList.toArray(new Resource[]{}));
    config.afterPropertiesSet();
    return config.getObject();
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:17,代码来源:Configs.java

示例9: sqlSessionFactory

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
@Bean  
@ConditionalOnMissingBean  
public SqlSessionFactory sqlSessionFactory() throws Exception {  
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();  
    sqlSessionFactoryBean.setDataSource(roundRobinDataSouceProxy());  
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mybatis/*.xml"));
    sqlSessionFactoryBean.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);  
    return sqlSessionFactoryBean.getObject();  
}
 
开发者ID:duanyaxin,项目名称:springboot-smart,代码行数:11,代码来源:Application.java

示例10: loadAllLevels

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
/**
 * Load all levels.
 *
 * @throws IOException
 *             iff wrong path.
 */
private static void loadAllLevels() throws IOException {
	PathMatchingResourcePatternResolver resolv = new PathMatchingResourcePatternResolver(ModManager.SYSLOADER);
	Resource[] unknown = resolv.getResources("classpath*:/levels/level*.dat");
	Resource[] subdirs = resolv.getResources("classpath*:/levels/*/level*.dat");
	Resource[] res = new Resource[unknown.length + subdirs.length];
	System.arraycopy(unknown, 0, res, 0, unknown.length);
	System.arraycopy(subdirs, 0, res, unknown.length, subdirs.length);

	Stream<Resource> numbered = Arrays.stream(res).filter(r -> r.getFilename().matches("level_\\d+\\.dat"));
	Stream<Resource> notNumbered = Arrays.stream(res).filter(r -> !r.getFilename().matches("level_\\d+\\.dat"));

	numbered.sorted((r1, r2) -> {
		String n1 = r1.getFilename().substring("level_".length()).split("\\.")[0];
		String n2 = r2.getFilename().substring("level_".length()).split("\\.")[0];
		return Integer.compare(Integer.parseInt(n1), Integer.parseInt(n2));
	}).forEach(LevelManager::addArcadeLevel);
	notNumbered.sorted((r1, r2) -> r1.toString().compareToIgnoreCase(r2.toString())).forEach(LevelManager::addArcadeLevel);

	LevelManager.loadInfiniteLevels();
	LevelManager.loadCustomLevels();
}
 
开发者ID:rekit-group,项目名称:rekit-game,代码行数:28,代码来源:LevelManager.java

示例11: setUp

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
    moduleService = new ModuleServiceImpl();
    Resource simpleMod = new PathMatchingResourcePatternResolver().getResource("classpath:alfresco/module/simplemodule.properties");
    assertNotNull(simpleMod);
    RegistryService reg = mock(RegistryService.class);
    ApplicationContext applicationContext = mock(ApplicationContext.class);

    when(reg.getProperty((RegistryKey) anyObject())).thenAnswer(new Answer<Serializable>()
    {
        public Serializable answer(InvocationOnMock invocation) throws Throwable
        {
            RegistryKey key = (RegistryKey) invocation.getArguments()[0];
            return new ModuleVersionNumber("1.1");
        }
    });
    doReturn(Arrays.asList("fee", "alfresco-simple-module", "fo")).when(reg).getChildElements((RegistryKey) anyObject());
    doReturn(new Resource[] {simpleMod}).when(applicationContext).getResources(anyString());
    moduleService.setRegistryService(reg);
    moduleService.setApplicationContext(applicationContext);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:ModuleServiceImplTest.java

示例12: sqlSessionFactory

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
@Bean public SqlSessionFactory sqlSessionFactory() throws Exception {
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSource());
    //mybatis分页
    PageHelper pageHelper = new PageHelper();
    Properties props = new Properties();
    props.setProperty("dialect", "mysql");
    props.setProperty("reasonable", "true");
    props.setProperty("supportMethodsArguments", "true");
    props.setProperty("returnPageInfo", "check");
    props.setProperty("params", "count=countSql");
    pageHelper.setProperties(props); //添加插件
    sqlSessionFactoryBean.setPlugins(new Interceptor[]{pageHelper});
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/me/caixin/dao/mapping/**/*.xml"));
    return sqlSessionFactoryBean.getObject();
}
 
开发者ID:cairenjie1985,项目名称:springBoot-demo,代码行数:18,代码来源:MyBatisAutoConfiguration.java

示例13: findMyTypes

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
protected List<Class<?>> findMyTypes(String basePackage) throws IOException, ClassNotFoundException {
	ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
	MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resourcePatternResolver);

	List<Class<?>> candidates = new ArrayList<>();
	String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + resolveBasePackage(basePackage)
	                           + "/" + "**/*.class";
	Resource[] resources = resourcePatternResolver.getResources(packageSearchPath);
	for (Resource resource : resources) {
		if (resource.isReadable()) {
			MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(resource);
			if (isCandidate(metadataReader)) {
				candidates.add(forName(metadataReader.getClassMetadata().getClassName()));
			}
		}
	}
	return candidates;
}
 
开发者ID:namics,项目名称:spring-batch-support,代码行数:19,代码来源:AutomaticJobRegistrarConfigurationSupport.java

示例14: findMangoDaoClasses

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
private List<Class<?>> findMangoDaoClasses(String packages) {
    try {
        List<Class<?>> daos = new ArrayList<Class<?>>();
        ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
        MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resourcePatternResolver);
        for (String locationPattern : getLocationPattern(packages)) {
            Resource[] rs = resourcePatternResolver.getResources(locationPattern);
            for (Resource r : rs) {
                MetadataReader reader = metadataReaderFactory.getMetadataReader(r);
                AnnotationMetadata annotationMD = reader.getAnnotationMetadata();
                if (annotationMD.hasAnnotation(DB.class.getName())) {
                    ClassMetadata clazzMD = reader.getClassMetadata();
                    daos.add(Class.forName(clazzMD.getClassName()));
                }
            }
        }
        return daos;
    } catch (Exception e) {
        throw new IllegalStateException(e.getMessage(), e);
    }
}
 
开发者ID:jfaster,项目名称:mango-spring-boot-starter,代码行数:22,代码来源:MangoDaoAutoCreator.java

示例15: sqlSessionFactory

import org.springframework.core.io.support.PathMatchingResourcePatternResolver; //导入依赖的package包/类
@Bean
public SqlSessionFactory sqlSessionFactory() throws Exception {
    SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
    sqlSessionFactoryBean.setDataSource(dataSource());
    //mybatis分页
    PageHelper pageHelper = new PageHelper();
    Properties props = new Properties();
    props.setProperty("dialect", "mysql");
    props.setProperty("reasonable", "true");
    props.setProperty("supportMethodsArguments", "true");
    props.setProperty("returnPageInfo", "check");
    props.setProperty("params", "count=countSql");
    pageHelper.setProperties(props); //添加插件
    sqlSessionFactoryBean.setPlugins(new Interceptor[]{pageHelper});
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:org/xxpay/dal/dao/mapper/*.xml"));
    return sqlSessionFactoryBean.getObject();
}
 
开发者ID:ywtnhm,项目名称:pay-xxpay-master,代码行数:19,代码来源:DruidDataSourceConfig.java


注:本文中的org.springframework.core.io.support.PathMatchingResourcePatternResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。