本文整理汇总了Java中org.springframework.core.io.support.ResourcePatternUtils.getResourcePatternResolver方法的典型用法代码示例。如果您正苦于以下问题:Java ResourcePatternUtils.getResourcePatternResolver方法的具体用法?Java ResourcePatternUtils.getResourcePatternResolver怎么用?Java ResourcePatternUtils.getResourcePatternResolver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.io.support.ResourcePatternUtils
的用法示例。
在下文中一共展示了ResourcePatternUtils.getResourcePatternResolver方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: LocalSessionFactoryBuilder
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
/**
* Create a new LocalSessionFactoryBuilder for the given DataSource.
* @param dataSource the JDBC DataSource that the resulting Hibernate SessionFactory should be using
* (may be {@code null})
* @param resourceLoader the ResourceLoader to load application classes from
*/
@SuppressWarnings("deprecation") // to be able to build against Hibernate 4.3
public LocalSessionFactoryBuilder(DataSource dataSource, ResourceLoader resourceLoader) {
getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
if (dataSource != null) {
getProperties().put(Environment.DATASOURCE, dataSource);
}
// APP_CLASSLOADER is deprecated as of Hibernate 4.3 but we need to remain compatible with 4.0+
getProperties().put(AvailableSettings.APP_CLASSLOADER, resourceLoader.getClassLoader());
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}
示例2: LocalSessionFactoryBuilder
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
/**
* Create a new LocalSessionFactoryBuilder for the given DataSource.
* @param dataSource the JDBC DataSource that the resulting Hibernate SessionFactory should be using
* (may be {@code null})
* @param resourceLoader the ResourceLoader to load application classes from
*/
public LocalSessionFactoryBuilder(DataSource dataSource, ResourceLoader resourceLoader) {
getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
if (dataSource != null) {
getProperties().put(Environment.DATASOURCE, dataSource);
}
getProperties().put(AvailableSettings.CLASSLOADERS, Collections.singleton(resourceLoader.getClassLoader()));
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}
示例3: setApplicationContext
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(applicationContext);
String dsName = ConnectionSource.DEFAULT.equals(dataSourceName) ? "dataSource" : "dataSource_" + dataSourceName;
Properties properties = getProperties();
if(applicationContext.containsBean(dsName)) {
properties.put(Environment.DATASOURCE, applicationContext.getBean(dsName));
}
properties.put(Environment.CURRENT_SESSION_CONTEXT_CLASS, currentSessionContext.getName());
properties.put(AvailableSettings.CLASSLOADERS, applicationContext.getClassLoader());
}
示例4: HibernateSpringSessionFactoryBuilder
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
/**
* Create a new LocalSessionFactoryBuilder for the given DataSource.
*
* @param dataSource the JDBC DataSource that the resulting Hibernate SessionFactory should be using
* (may be {@code null})
* @param resourceLoader the ResourceLoader to load application classes from
* @param metadataSources the Hibernate MetadataSources service to use (e.g. reusing an existing one)
* @since 4.3
*/
public HibernateSpringSessionFactoryBuilder(DataSource dataSource, ResourceLoader resourceLoader, MetadataSources metadataSources) {
super(metadataSources);
getProperties().put(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
if (dataSource != null) {
getProperties().put(AvailableSettings.DATASOURCE, dataSource);
}
// Hibernate 5.1/5.2: manually enforce connection release mode ON_CLOSE (the former default)
try {
// Try Hibernate 5.2
AvailableSettings.class.getField("CONNECTION_HANDLING");
getProperties().put("hibernate.connection.handling_mode", "DELAYED_ACQUISITION_AND_HOLD");
} catch (NoSuchFieldException ex) {
// Try Hibernate 5.1
try {
AvailableSettings.class.getField("ACQUIRE_CONNECTIONS");
getProperties().put("hibernate.connection.release_mode", "ON_CLOSE");
} catch (NoSuchFieldException ex2) {
// on Hibernate 5.0.x or lower - no need to change the default there
}
}
getProperties().put(AvailableSettings.CLASSLOADERS, Collections.singleton(resourceLoader.getClassLoader()));
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}
示例5: setResourceLoader
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
/**
* 设定 ResourceLoader
* @param resourceLoader {@link ResourceLoader}
*/
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourcePatternResolver = ResourcePatternUtils
.getResourcePatternResolver(resourceLoader);
this.metadataReaderFactory = new CachingMetadataReaderFactory(
resourceLoader);
}
示例6: buildApplication
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
public static SdcctApplication buildApplication() {
ResourceLoader resourceLoader = new DefaultResourceLoader();
ResourcePatternResolver resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
SdcctApplication app = ((SdcctApplication) new SdcctApplicationBuilder(buildSources(resourcePatternResolver)).addCommandLineProperties(false)
.bannerMode(Mode.OFF).headless(true).resourceLoader(resourceLoader).application());
app.setPropertySource(buildPropertySource(resourcePatternResolver));
app.setListeners(
app.getListeners().stream().filter((appListener -> !appListener.getClass().equals(LoggingApplicationListener.class))).collect(Collectors.toList()));
return app;
}
示例7: LocalSessionFactoryBuilder
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
/**
* Create a new LocalSessionFactoryBuilder for the given DataSource.
* @param dataSource the JDBC DataSource that the resulting Hibernate SessionFactory should be using
* (may be {@code null})
* @param resourceLoader the ResourceLoader to load application classes from
*/
public LocalSessionFactoryBuilder(DataSource dataSource, ResourceLoader resourceLoader) {
getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
if (dataSource != null) {
getProperties().put(Environment.DATASOURCE, dataSource);
}
getProperties().put(AvailableSettings.APP_CLASSLOADER, resourceLoader.getClassLoader());
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}
示例8: SortedResourcesFactoryBean
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
public SortedResourcesFactoryBean(ResourceLoader resourceLoader, List<String> locations) {
this.locations = locations;
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}
示例9: setResourceLoader
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
@Override
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}
示例10: getResources
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
private Resource[] getResources(String packagePath) throws IOException {
ResourcePatternResolver resourceResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
Resource[] resources = resourceResolver.getResources(packagePath);
return resources;
}
示例11: setResourceLoader
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
this.metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader);
}
示例12: ReverseOrderResourceLoader
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
ReverseOrderResourceLoader(ResourceLoader loader) {
this.resolver = ResourcePatternUtils.getResourcePatternResolver(loader);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:4,代码来源:DataSourceInitializerTests.java
示例13: setResourceLoader
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
public void setResourceLoader(ResourceLoader resourceLoader) {
resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}
示例14: ClassPathScanner
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
public ClassPathScanner(ClassLoader classLoader) {
DefaultResourceLoader defaultResourceLoader = new DefaultResourceLoader(classLoader);
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(defaultResourceLoader);
this.metadataReaderFactory = new CachingMetadataReaderFactory(defaultResourceLoader);
}
示例15: setResourceLoader
import org.springframework.core.io.support.ResourcePatternUtils; //导入方法依赖的package包/类
@Override
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
}