當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。