Here are the examples of the java api org.springframework.util.ClassUtils.getDefaultClassLoader() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
60 Examples
19
View Source File : BshScriptUtils.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Create a new BeanShell-scripted object from the given script source,
* using the default ClreplacedLoader.
* <p>The script may either be a simple script that needs a corresponding proxy
* generated (implementing the specified interfaces), or declare a full clreplaced
* or return an actual instance of the scripted object (in which case the
* specified interfaces, if any, need to be implemented by that clreplaced/instance).
* @param scriptSource the script source text
* @param scriptInterfaces the interfaces that the scripted Java object is
* supposed to implement (may be {@code null} or empty if the script itself
* declares a full clreplaced or returns an actual instance of the scripted object)
* @return the scripted Java object
* @throws EvalError in case of BeanShell parsing failure
* @see #createBshObject(String, Clreplaced[], ClreplacedLoader)
*/
public static Object createBshObject(String scriptSource, @Nullable Clreplaced<?>... scriptInterfaces) throws EvalError {
return createBshObject(scriptSource, scriptInterfaces, ClreplacedUtils.getDefaultClreplacedLoader());
}
19
View Source File : AspectJExpressionPointcut.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Determine the ClreplacedLoader to use for pointcut evaluation.
*/
@Nullable
private ClreplacedLoader determinePointcutClreplacedLoader() {
if (this.beanFactory instanceof ConfigurableBeanFactory) {
return ((ConfigurableBeanFactory) this.beanFactory).getBeanClreplacedLoader();
}
if (this.pointcutDeclarationScope != null) {
return this.pointcutDeclarationScope.getClreplacedLoader();
}
return ClreplacedUtils.getDefaultClreplacedLoader();
}
19
View Source File : SpringApplication.java
License : Apache License 2.0
Project Creator : spring-io
License : Apache License 2.0
Project Creator : spring-io
/**
* Either the ClreplacedLoader that will be used in the ApplicationContext (if
* {@link #setResourceLoader(ResourceLoader) resourceLoader} is set, or the context
* clreplaced loader (if not null), or the loader of the Spring {@link ClreplacedUtils} clreplaced.
* @return a ClreplacedLoader (never null)
*/
public ClreplacedLoader getClreplacedLoader() {
if (this.resourceLoader != null) {
return this.resourceLoader.getClreplacedLoader();
}
return ClreplacedUtils.getDefaultClreplacedLoader();
}
19
View Source File : AWSLambdaUtils.java
License : Apache License 2.0
Project Creator : spring-cloud
License : Apache License 2.0
Project Creator : spring-cloud
private static boolean isAPIGatewayProxyRequestEventPresent() {
return ClreplacedUtils.isPresent("com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent", ClreplacedUtils.getDefaultClreplacedLoader());
}
19
View Source File : ExcludeSpringBootRedisAutoConfigProcessor.java
License : Apache License 2.0
Project Creator : spring-avengers
License : Apache License 2.0
Project Creator : spring-avengers
private boolean isPresent(String clreplacedName) {
ClreplacedLoader clreplacedLoader = ClreplacedUtils.getDefaultClreplacedLoader();
try {
forName(clreplacedName, clreplacedLoader);
return true;
} catch (Throwable ex) {
return false;
}
}
19
View Source File : TestModeUtil.java
License : Apache License 2.0
Project Creator : sofastack
License : Apache License 2.0
Project Creator : sofastack
public static boolean isArkMode() {
try {
Clreplaced clazz = ClreplacedUtils.getDefaultClreplacedLoader().loadClreplaced(SOFA_ARK_BOOT_STRAPPER);
return clazz != null;
} catch (ClreplacedNotFoundException ex) {
return false;
}
}
19
View Source File : JRubyScriptUtils.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
/**
* Create a new JRuby-scripted object from the given script source,
* using the default {@link ClreplacedLoader}.
* @param scriptSource the script source text
* @param interfaces the interfaces that the scripted Java object is to implement
* @return the scripted Java object
* @throws JumpException in case of JRuby parsing failure
* @see ClreplacedUtils#getDefaultClreplacedLoader()
*/
public static Object createJRubyObject(String scriptSource, Clreplaced<?>... interfaces) throws JumpException {
return createJRubyObject(scriptSource, interfaces, ClreplacedUtils.getDefaultClreplacedLoader());
}
19
View Source File : BshScriptUtils.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
/**
* Create a new BeanShell-scripted object from the given script source,
* using the default ClreplacedLoader.
* <p>The script may either be a simple script that needs a corresponding proxy
* generated (implementing the specified interfaces), or declare a full clreplaced
* or return an actual instance of the scripted object (in which case the
* specified interfaces, if any, need to be implemented by that clreplaced/instance).
* @param scriptSource the script source text
* @param scriptInterfaces the interfaces that the scripted Java object is
* supposed to implement (may be {@code null} or empty if the script itself
* declares a full clreplaced or returns an actual instance of the scripted object)
* @return the scripted Java object
* @throws EvalError in case of BeanShell parsing failure
* @see #createBshObject(String, Clreplaced[], ClreplacedLoader)
*/
public static Object createBshObject(String scriptSource, Clreplaced<?>... scriptInterfaces) throws EvalError {
return createBshObject(scriptSource, scriptInterfaces, ClreplacedUtils.getDefaultClreplacedLoader());
}
18
View Source File : XmLepScriptConfigServerResourceLoader.java
License : Apache License 2.0
Project Creator : xm-online
License : Apache License 2.0
Project Creator : xm-online
/**
* {@inheritDoc}
*/
@Override
public ClreplacedLoader getClreplacedLoader() {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
18
View Source File : MockServletContext.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
@Nullable
public ClreplacedLoader getClreplacedLoader() {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
18
View Source File : ContextLoader.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Return the WebApplicationContext implementation clreplaced to use, either the
* default XmlWebApplicationContext or a custom context clreplaced if specified.
* @param servletContext current servlet context
* @return the WebApplicationContext implementation clreplaced to use
* @see #CONTEXT_CLreplaced_PARAM
* @see org.springframework.web.context.support.XmlWebApplicationContext
*/
protected Clreplaced<?> determineContextClreplaced(ServletContext servletContext) {
String contextClreplacedName = servletContext.getInitParameter(CONTEXT_CLreplaced_PARAM);
if (contextClreplacedName != null) {
try {
// 通过反射的形式创建实例
return ClreplacedUtils.forName(contextClreplacedName, ClreplacedUtils.getDefaultClreplacedLoader());
} catch (ClreplacedNotFoundException ex) {
throw new ApplicationContextException("Failed to load custom context clreplaced [" + contextClreplacedName + "]", ex);
}
} else {
// defaultStrategies 是个静态变量,在静态代码块中初始化
contextClreplacedName = defaultStrategies.getProperty(WebApplicationContext.clreplaced.getName());
try {
return ClreplacedUtils.forName(contextClreplacedName, ContextLoader.clreplaced.getClreplacedLoader());
} catch (ClreplacedNotFoundException ex) {
throw new ApplicationContextException("Failed to load default context clreplaced [" + contextClreplacedName + "]", ex);
}
}
}
18
View Source File : DriverManagerDataSource.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Set the JDBC driver clreplaced name. This driver will get initialized
* on startup, registering itself with the JDK's DriverManager.
* <p><b>NOTE: DriverManagerDataSource is primarily intended for accessing
* <i>pre-registered</i> JDBC drivers.</b> If you need to register a new driver,
* consider using {@link SimpleDriverDataSource} instead. Alternatively, consider
* initializing the JDBC driver yourself before instantiating this DataSource.
* The "driverClreplacedName" property is mainly preserved for backwards compatibility,
* as well as for migrating between Commons DBCP and this DataSource.
* @see java.sql.DriverManager#registerDriver(java.sql.Driver)
* @see SimpleDriverDataSource
*/
public void setDriverClreplacedName(String driverClreplacedName) {
replacedert.hasText(driverClreplacedName, "Property 'driverClreplacedName' must not be empty");
String driverClreplacedNameToUse = driverClreplacedName.trim();
try {
Clreplaced.forName(driverClreplacedNameToUse, true, ClreplacedUtils.getDefaultClreplacedLoader());
} catch (ClreplacedNotFoundException ex) {
throw new IllegalStateException("Could not load JDBC driver clreplaced [" + driverClreplacedNameToUse + "]", ex);
}
if (logger.isDebugEnabled()) {
logger.debug("Loaded JDBC driver: " + driverClreplacedNameToUse);
}
}
18
View Source File : JdkDynamicAopProxy.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
public Object getProxy() {
return getProxy(ClreplacedUtils.getDefaultClreplacedLoader());
}
18
View Source File : ContextLoader.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
/**
* Return the WebApplicationContext implementation clreplaced to use, either the
* default XmlWebApplicationContext or a custom context clreplaced if specified.
* @param servletContext current servlet context
* @return the WebApplicationContext implementation clreplaced to use
* @see #CONTEXT_CLreplaced_PARAM
* @see org.springframework.web.context.support.XmlWebApplicationContext
*/
protected Clreplaced<?> determineContextClreplaced(ServletContext servletContext) {
String contextClreplacedName = servletContext.getInitParameter(CONTEXT_CLreplaced_PARAM);
if (contextClreplacedName != null) {
try {
return ClreplacedUtils.forName(contextClreplacedName, ClreplacedUtils.getDefaultClreplacedLoader());
} catch (ClreplacedNotFoundException ex) {
throw new ApplicationContextException("Failed to load custom context clreplaced [" + contextClreplacedName + "]", ex);
}
} else {
contextClreplacedName = defaultStrategies.getProperty(WebApplicationContext.clreplaced.getName());
try {
return ClreplacedUtils.forName(contextClreplacedName, ContextLoader.clreplaced.getClreplacedLoader());
} catch (ClreplacedNotFoundException ex) {
throw new ApplicationContextException("Failed to load default context clreplaced [" + contextClreplacedName + "]", ex);
}
}
}
18
View Source File : MockServletContext.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
@Override
public ClreplacedLoader getClreplacedLoader() {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
18
View Source File : StubWebApplicationContext.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
// ---------------------------------------------------------------------
// Implementation of ResourceLoader interface
// ---------------------------------------------------------------------
@Override
public ClreplacedLoader getClreplacedLoader() {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
18
View Source File : MutablePersistenceUnitInfo.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
/**
* This implementation returns the default ClreplacedLoader.
* @see org.springframework.util.ClreplacedUtils#getDefaultClreplacedLoader()
*/
@Override
public ClreplacedLoader getClreplacedLoader() {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
18
View Source File : DriverManagerDataSource.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
/**
* Set the JDBC driver clreplaced name. This driver will get initialized
* on startup, registering itself with the JDK's DriverManager.
* <p><b>NOTE: DriverManagerDataSource is primarily intended for accessing
* <i>pre-registered</i> JDBC drivers.</b> If you need to register a new driver,
* consider using {@link SimpleDriverDataSource} instead. Alternatively, consider
* initializing the JDBC driver yourself before instantiating this DataSource.
* The "driverClreplacedName" property is mainly preserved for backwards compatibility,
* as well as for migrating between Commons DBCP and this DataSource.
* @see java.sql.DriverManager#registerDriver(java.sql.Driver)
* @see SimpleDriverDataSource
*/
public void setDriverClreplacedName(String driverClreplacedName) {
replacedert.hasText(driverClreplacedName, "Property 'driverClreplacedName' must not be empty");
String driverClreplacedNameToUse = driverClreplacedName.trim();
try {
Clreplaced.forName(driverClreplacedNameToUse, true, ClreplacedUtils.getDefaultClreplacedLoader());
} catch (ClreplacedNotFoundException ex) {
throw new IllegalStateException("Could not load JDBC driver clreplaced [" + driverClreplacedNameToUse + "]", ex);
}
if (logger.isInfoEnabled()) {
logger.info("Loaded JDBC driver: " + driverClreplacedNameToUse);
}
}
18
View Source File : JmxUtils.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
/**
* Convert an array of {@code MBeanParameterInfo} into an array of
* {@code Clreplaced} instances corresponding to the parameters.
* @param paramInfo the JMX parameter info
* @return the parameter types as clreplacedes
* @throws ClreplacedNotFoundException if a parameter type could not be resolved
*/
public static Clreplaced<?>[] parameterInfoToTypes(MBeanParameterInfo[] paramInfo) throws ClreplacedNotFoundException {
return parameterInfoToTypes(paramInfo, ClreplacedUtils.getDefaultClreplacedLoader());
}
18
View Source File : SimpleBeanFactoryAwareAspectInstanceFactory.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
@Override
public ClreplacedLoader getAspectClreplacedLoader() {
if (this.beanFactory instanceof ConfigurableBeanFactory) {
return ((ConfigurableBeanFactory) this.beanFactory).getBeanClreplacedLoader();
} else {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
}
17
View Source File : TomcatReactiveWebServerFactory.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
protected void prepareContext(Host host, TomcatHttpHandlerAdapter servlet) {
File docBase = createTempDir("tomcat-docbase");
TomcatEmbeddedContext context = new TomcatEmbeddedContext();
context.setPath("");
context.setDocBase(docBase.getAbsolutePath());
context.addLifecycleListener(new Tomcat.FixContextListener());
context.setParentClreplacedLoader(ClreplacedUtils.getDefaultClreplacedLoader());
skipAllTldScanning(context);
WebappLoader loader = new WebappLoader(context.getParentClreplacedLoader());
loader.setLoaderClreplaced(TomcatEmbeddedWebappClreplacedLoader.clreplaced.getName());
loader.setDelegate(true);
context.setLoader(loader);
Tomcat.addServlet(context, "httpHandlerServlet", servlet).setAsyncSupported(true);
context.addServletMappingDecoded("/", "httpHandlerServlet");
host.addChild(context);
configureContext(context);
}
17
View Source File : DelegatingApplicationContextInitializer.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
private Clreplaced<?> getInitializerClreplaced(String clreplacedName) throws LinkageError {
try {
Clreplaced<?> initializerClreplaced = ClreplacedUtils.forName(clreplacedName, ClreplacedUtils.getDefaultClreplacedLoader());
replacedert.isreplacedignable(ApplicationContextInitializer.clreplaced, initializerClreplaced);
return initializerClreplaced;
} catch (ClreplacedNotFoundException ex) {
throw new ApplicationContextException("Failed to load context initializer clreplaced [" + clreplacedName + "]", ex);
}
}
17
View Source File : ContextLoader.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@SuppressWarnings("unchecked")
private Clreplaced<ApplicationContextInitializer<ConfigurableApplicationContext>> loadInitializerClreplaced(String clreplacedName) {
try {
Clreplaced<?> clazz = ClreplacedUtils.forName(clreplacedName, ClreplacedUtils.getDefaultClreplacedLoader());
if (!ApplicationContextInitializer.clreplaced.isreplacedignableFrom(clazz)) {
throw new ApplicationContextException("Initializer clreplaced does not implement ApplicationContextInitializer interface: " + clazz);
}
return (Clreplaced<ApplicationContextInitializer<ConfigurableApplicationContext>>) clazz;
} catch (ClreplacedNotFoundException ex) {
throw new ApplicationContextException("Failed to load context initializer clreplaced [" + clreplacedName + "]", ex);
}
}
17
View Source File : StubWebApplicationContext.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
// ---------------------------------------------------------------------
// Implementation of ResourceLoader interface
// ---------------------------------------------------------------------
@Override
@Nullable
public ClreplacedLoader getClreplacedLoader() {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
17
View Source File : MutablePersistenceUnitInfo.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* This implementation returns the default ClreplacedLoader.
* @see org.springframework.util.ClreplacedUtils#getDefaultClreplacedLoader()
*/
@Override
@Nullable
public ClreplacedLoader getClreplacedLoader() {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
17
View Source File : JmxUtils.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
/**
* Convert an array of {@code MBeanParameterInfo} into an array of
* {@code Clreplaced} instances corresponding to the parameters.
* @param paramInfo the JMX parameter info
* @return the parameter types as clreplacedes
* @throws ClreplacedNotFoundException if a parameter type could not be resolved
*/
@Nullable
public static Clreplaced<?>[] parameterInfoToTypes(@Nullable MBeanParameterInfo[] paramInfo) throws ClreplacedNotFoundException {
return parameterInfoToTypes(paramInfo, ClreplacedUtils.getDefaultClreplacedLoader());
}
17
View Source File : SimpleBeanFactoryAwareAspectInstanceFactory.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
@Nullable
public ClreplacedLoader getAspectClreplacedLoader() {
if (this.beanFactory instanceof ConfigurableBeanFactory) {
return ((ConfigurableBeanFactory) this.beanFactory).getBeanClreplacedLoader();
} else {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
}
17
View Source File : ContextLoader.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
@SuppressWarnings("unchecked")
private Clreplaced<ApplicationContextInitializer<ConfigurableApplicationContext>> loadInitializerClreplaced(String clreplacedName) {
try {
Clreplaced<?> clazz = ClreplacedUtils.forName(clreplacedName, ClreplacedUtils.getDefaultClreplacedLoader());
replacedert.isreplacedignable(ApplicationContextInitializer.clreplaced, clazz);
return (Clreplaced<ApplicationContextInitializer<ConfigurableApplicationContext>>) clazz;
} catch (ClreplacedNotFoundException ex) {
throw new ApplicationContextException("Failed to load context initializer clreplaced [" + clreplacedName + "]", ex);
}
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void implicitFile() {
List<String> urls = ResourceUtils.getUrls("src/test/resources/init.groovy", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void explicitFile() {
List<String> urls = ResourceUtils.getUrls("file:src/test/resources/init.groovy", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void recursiveFiles() {
List<String> urls = ResourceUtils.getUrls("src/test/resources/dir-sample", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void implicitClreplacedpathResource() {
List<String> urls = ResourceUtils.getUrls("init.groovy", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void implicitClreplacedpathResourceWithSlash() {
List<String> urls = ResourceUtils.getUrls("/init.groovy", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void directoryOfFilesWithPrefix() {
List<String> urls = ResourceUtils.getUrls("file:src/test/resources/dir-sample/code/*", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void recursiveFilesByPatternWithPrefix() {
List<String> urls = ResourceUtils.getUrls("file:src/test/resources/dir-sample/**/*.groovy", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void directoryOfFiles() {
List<String> urls = ResourceUtils.getUrls("src/test/resources/dir-sample/code/*", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void recursiveFilesByPattern() {
List<String> urls = ResourceUtils.getUrls("src/test/resources/dir-sample/**/*.groovy", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void explicitClreplacedpathResource() {
List<String> urls = ResourceUtils.getUrls("clreplacedpath:init.groovy", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : ResourceUtilsTests.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Test
public void explicitClreplacedpathResourceWithSlash() {
List<String> urls = ResourceUtils.getUrls("clreplacedpath:/init.groovy", ClreplacedUtils.getDefaultClreplacedLoader());
replacedertThat(urls).hreplacedize(1);
replacedertThat(urls.get(0).startsWith("file:")).isTrue();
}
16
View Source File : FileUtil.java
License : Apache License 2.0
Project Creator : yfh0918
License : Apache License 2.0
Project Creator : yfh0918
/**
* clreplacedpath下的路径
* @param fileDir 文件路径
* @return
*/
public static String getFullPath(String fileDir) throws IOException {
URL url = ClreplacedUtils.getDefaultClreplacedLoader().getResource("");
String path = java.net.URLDecoder.decode(url.getPath(), Charset.defaultCharset().name());
// file:/C:/projects/bin/xxxxx/yyyy.jar!/BOOT-INF/clreplacedes!/
if (path.startsWith("file:")) {
path = path.substring(5);
}
path = path.split("!")[0];
if (path.endsWith(".jar")) {
path = new File(path).getParent();
}
if (StringUtil.isEmpty(fileDir)) {
return path;
}
return path + File.separator + fileDir;
}
16
View Source File : ClassloadingAssertions.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
private static boolean isClreplacedLoaded(String clreplacedName) {
ClreplacedLoader cl = ClreplacedUtils.getDefaultClreplacedLoader();
Method findLoadedClreplacedMethod = ReflectionUtils.findMethod(cl.getClreplaced(), "findLoadedClreplaced", String.clreplaced);
ReflectionUtils.makeAccessible(findLoadedClreplacedMethod);
Clreplaced<?> loadedClreplaced = (Clreplaced<?>) ReflectionUtils.invokeMethod(findLoadedClreplacedMethod, cl, clreplacedName);
return loadedClreplaced != null;
}
16
View Source File : ResourceLoaderResourceResolverUnitTests.java
License : Apache License 2.0
Project Creator : spring-projects
License : Apache License 2.0
Project Creator : spring-projects
@Test
public void newResourceLoaderReturnsDefaultResourceLoaderWithDefaultClreplacedLoader() {
ResourceLoaderResourceResolver resourceResolver = spy(new ResourceLoaderResourceResolver());
ResourceLoader resourceLoader = resourceResolver.newResourceLoader();
replacedertThat(resourceLoader).isInstanceOf(DefaultResourceLoader.clreplaced);
replacedertThat(resourceLoader.getClreplacedLoader()).isEqualTo(ClreplacedUtils.getDefaultClreplacedLoader());
verify(resourceResolver, times(1)).getClreplacedLoader();
}
16
View Source File : ClassloadingAssertions.java
License : Apache License 2.0
Project Creator : langtianya
License : Apache License 2.0
Project Creator : langtianya
private static boolean isClreplacedLoaded(String clreplacedName) {
ClreplacedLoader cl = ClreplacedUtils.getDefaultClreplacedLoader();
Method findLoadeClreplacedMethod = ReflectionUtils.findMethod(cl.getClreplaced(), "findLoadedClreplaced", new Clreplaced[] { String.clreplaced });
ReflectionUtils.makeAccessible(findLoadeClreplacedMethod);
Clreplaced<?> loadedClreplaced = (Clreplaced<?>) ReflectionUtils.invokeMethod(findLoadeClreplacedMethod, cl, new Object[] { clreplacedName });
return loadedClreplaced != null;
}
16
View Source File : BeanUtilsTest.java
License : Apache License 2.0
Project Creator : alibaba
License : Apache License 2.0
Project Creator : alibaba
@Test
public void testResolveBeanType() {
ClreplacedLoader clreplacedLoader = ClreplacedUtils.getDefaultClreplacedLoader();
Clreplaced<?> beanType = BeanUtils.resolveBeanType(this.getClreplaced().getName(), clreplacedLoader);
replacedert.replacedertEquals(beanType, this.getClreplaced());
beanType = BeanUtils.resolveBeanType("", clreplacedLoader);
replacedert.replacedertNull(beanType);
beanType = BeanUtils.resolveBeanType(" ", clreplacedLoader);
replacedert.replacedertNull(beanType);
beanType = BeanUtils.resolveBeanType("java.lang.Abc", clreplacedLoader);
replacedert.replacedertNull(beanType);
}
15
View Source File : SpringFactoriesLoaderExampleConfiguration.java
License : Apache License 2.0
Project Creator : penggle
License : Apache License 2.0
Project Creator : penggle
@Override
public void afterPropertiesSet() throws Exception {
List<String> autoConfigurationNames = SpringFactoriesLoader.loadFactoryNames(EnableAutoConfiguration.clreplaced, ClreplacedUtils.getDefaultClreplacedLoader());
System.out.println("【获取@EnableAutoConfiguration自动配置列表】>>> ");
for (String autoConfigurationName : autoConfigurationNames) {
System.out.println("\t" + autoConfigurationName);
}
System.out.println("【获取@EnableAutoConfiguration自动配置列表】<<< ");
}
15
View Source File : SimpleEmailServiceJavaMailSender.java
License : Apache License 2.0
Project Creator : awspring
License : Apache License 2.0
Project Creator : awspring
@Override
public MimeMessage createMimeMessage() {
// We have to use reflection as SmartMimeMessage is not package-private
if (ClreplacedUtils.isPresent(SMART_MIME_MESSAGE_CLreplaced_NAME, ClreplacedUtils.getDefaultClreplacedLoader())) {
Clreplaced<?> smartMimeMessage = ClreplacedUtils.resolveClreplacedName(SMART_MIME_MESSAGE_CLreplaced_NAME, ClreplacedUtils.getDefaultClreplacedLoader());
Constructor<?> constructor = ClreplacedUtils.getConstructorIfAvailable(smartMimeMessage, Session.clreplaced, String.clreplaced, FileTypeMap.clreplaced);
if (constructor != null) {
Object mimeMessage = BeanUtils.instantiateClreplaced(constructor, getSession(), this.defaultEncoding, this.defaultFileTypeMap);
return (MimeMessage) mimeMessage;
}
}
return new MimeMessage(getSession());
}
14
View Source File : RouterResourceLoader.java
License : Apache License 2.0
Project Creator : xm-online
License : Apache License 2.0
Project Creator : xm-online
@Override
public ClreplacedLoader getClreplacedLoader() {
ResourceLoader resourceLoader = urlPrefixToResourceLoader.get(ResourceLoader.CLreplacedPATH_URL_PREFIX);
if (resourceLoader == null) {
resourceLoader = urlPrefixToResourceLoader.values().stream().findFirst().orElse(null);
}
if (resourceLoader == null) {
return ClreplacedUtils.getDefaultClreplacedLoader();
}
return resourceLoader.getClreplacedLoader();
}
14
View Source File : DefaultConditionContext.java
License : Apache License 2.0
Project Creator : spring-projects-experimental
License : Apache License 2.0
Project Creator : spring-projects-experimental
@Nullable
private ClreplacedLoader deduceClreplacedLoader(@Nullable ResourceLoader resourceLoader, @Nullable ConfigurableListableBeanFactory beanFactory) {
if (resourceLoader != null) {
ClreplacedLoader clreplacedLoader = resourceLoader.getClreplacedLoader();
if (clreplacedLoader != null) {
return clreplacedLoader;
}
}
if (beanFactory != null) {
return beanFactory.getBeanClreplacedLoader();
}
return ClreplacedUtils.getDefaultClreplacedLoader();
}
13
View Source File : ServiceProvider.java
License : MIT License
Project Creator : EzioL
License : MIT License
Project Creator : EzioL
public Object invoke(RpcRequest request) {
String clreplacedName = request.getClreplacedName();
Object service = clreplacedNameToServiceMap.get(clreplacedName);
replacedert.notNull(service, clreplacedName + "service not exist");
String[] parameterTypes = request.getParameterTypes();
Clreplaced[] parameterClreplacedes = Arrays.stream(parameterTypes).map(typeStr -> {
try {
return ClreplacedUtils.forName(typeStr, ClreplacedUtils.getDefaultClreplacedLoader());
} catch (ClreplacedNotFoundException e) {
throw new InvokeException("clreplaced not found", e);
}
}).toArray(Clreplaced[]::new);
Method method = ClreplacedUtils.getMethod(service.getClreplaced(), request.getMethodName(), parameterClreplacedes);
replacedert.notNull(method, request.getMethodName() + " method for service: " + clreplacedName + " should not be null");
Object result = null;
try {
result = method.invoke(service, request.getParameters());
} catch (IllegalAccessException | InvocationTargetException e) {
throw new InvokeException("invoke fail", e);
}
log.info("server service invoke: {}", result);
return result;
}
12
View Source File : AopUtils.java
License : Apache License 2.0
Project Creator : starblues-zhuo
License : Apache License 2.0
Project Creator : starblues-zhuo
/**
* 反射获取代理支持处理者的ClreplacedLoader属性值
* @param proxyProcessorSupport proxyProcessorSupport
* @return ClreplacedLoader
*/
private static ClreplacedLoader getClreplacedLoader(ProxyProcessorSupport proxyProcessorSupport) {
Clreplaced aClreplaced = proxyProcessorSupport.getClreplaced();
while (aClreplaced != null) {
if (aClreplaced != ProxyProcessorSupport.clreplaced) {
aClreplaced = aClreplaced.getSuperclreplaced();
continue;
}
Field[] declaredFields = aClreplaced.getDeclaredFields();
if (declaredFields == null || declaredFields.length == 0) {
break;
}
for (Field field : declaredFields) {
if (Objects.equals("proxyClreplacedLoader", field.getName()) || field.getType() == ClreplacedLoader.clreplaced) {
field.setAccessible(true);
try {
Object o = field.get(proxyProcessorSupport);
if (o instanceof ClreplacedLoader) {
return (ClreplacedLoader) o;
} else {
LOG.warn("Get {} clreplacedLoader type not is ClreplacedLoader type, And Return DefaultClreplacedLoader", aClreplaced.getName());
return ClreplacedUtils.getDefaultClreplacedLoader();
}
} catch (IllegalAccessException e) {
LOG.error("Get {} clreplacedLoader failure {}, And Return DefaultClreplacedLoader", aClreplaced.getName(), e.getMessage());
return ClreplacedUtils.getDefaultClreplacedLoader();
}
}
}
}
LOG.warn("Not found clreplacedLoader field, And Return DefaultClreplacedLoader", aClreplaced.getName());
return ClreplacedUtils.getDefaultClreplacedLoader();
}
See More Examples