io.micronaut.context.env.Environment.getClassLoader()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中io.micronaut.context.env.Environment.getClassLoader()方法的一些代码示例,展示了Environment.getClassLoader()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.getClassLoader()方法的具体详情如下:
包路径:io.micronaut.context.env.Environment
类名称:Environment
方法名:getClassLoader

Environment.getClassLoader介绍

暂无

代码示例

代码示例来源:origin: micronaut-projects/micronaut-core

/**
 * The resource factory.
 *
 * @param environment The environment
 */
@Inject
public ResourceLoaderFactory(Environment environment) {
  this.classLoader = environment.getClassLoader();
}

代码示例来源:origin: micronaut-projects/micronaut-spring

@Override
public ClassLoader getClassLoader() {
  if (environment instanceof MicronautEnvironment) {
    return ((MicronautEnvironment) environment).getEnvironment().getClassLoader();
  }
  return null;
}

代码示例来源:origin: io.micronaut/micronaut-inject

/**
 * Check whether the given class is present within this environment.
 *
 * @param className The class name
 * @return True if it is
 */
default boolean isPresent(String className) {
  return ClassUtils.isPresent(className, getClassLoader());
}

代码示例来源:origin: io.micronaut/inject

/**
 * Check whether the given class is present within this environment.
 *
 * @param className The class name
 * @return True if it is
 */
default boolean isPresent(String className) {
  return ClassUtils.isPresent(className, getClassLoader());
}

代码示例来源:origin: io.micronaut/micronaut-inject

/**
 * Scan the current environment for classes annotated with the given annotation. Use with care, repeated
 * invocations should be avoided for performance reasons.
 *
 * @param annotation The annotation to scan
 * @param packages   The packages to scan
 * @return The classes
 */
default Stream<Class> scan(Class<? extends Annotation> annotation, String... packages) {
  ClassPathAnnotationScanner scanner = new ClassPathAnnotationScanner(getClassLoader());
  return scanner.scan(annotation, Arrays.asList(packages));
}

代码示例来源:origin: io.micronaut/inject

/**
 * Scan the current environment for classes annotated with the given annotation. Use with care, repeated
 * invocations should be avoided for performance reasons.
 *
 * @param annotation The annotation to scan
 * @param packages   The packages to scan
 * @return The classes
 */
default Stream<Class> scan(Class<? extends Annotation> annotation, String... packages) {
  ClassPathAnnotationScanner scanner = new ClassPathAnnotationScanner(getClassLoader());
  return scanner.scan(annotation, Arrays.asList(packages));
}

代码示例来源:origin: io.micronaut/inject

/**
 * Scan the current environment for classes annotated with the given annotation. Use with care, repeated
 * invocations should be avoided for performance reasons.
 *
 * @param annotation The annotation to scan
 * @return The classes
 */
default Stream<Class> scan(Class<? extends Annotation> annotation) {
  ClassPathAnnotationScanner scanner = new ClassPathAnnotationScanner(getClassLoader());
  return scanner.scan(annotation, getPackages());
}

代码示例来源:origin: io.micronaut/micronaut-inject

/**
 * Scan the current environment for classes annotated with the given annotation. Use with care, repeated
 * invocations should be avoided for performance reasons.
 *
 * @param annotation The annotation to scan
 * @return The classes
 */
default Stream<Class> scan(Class<? extends Annotation> annotation) {
  ClassPathAnnotationScanner scanner = new ClassPathAnnotationScanner(getClassLoader());
  return scanner.scan(annotation, getPackages());
}

相关文章