OryxApplication.java 文件源码

java
阅读 23 收藏 0 点赞 0 评论 0

项目:oryx2 作者:
private Set<Class<?>> doGetClasses() {
  String packages =
      servletContext.getInitParameter(OryxApplication.class.getName() + ".packages");
  log.info("Creating JAX-RS from endpoints in package(s) {}", packages);
  Objects.requireNonNull(packages);
  Set<Class<?>> classes = new HashSet<>();
  for (String thePackage : packages.split(",")) {
    Reflections reflections = new Reflections(thePackage);
    classes.addAll(getClassesInPackageAnnotatedBy(thePackage, reflections, Path.class));
    classes.addAll(getClassesInPackageAnnotatedBy(thePackage, reflections, Produces.class));
    classes.addAll(getClassesInPackageAnnotatedBy(thePackage, reflections, Provider.class));
  }
  // Want to configure these globally, but not depend on Jersey, even though it's
  // what will be used in practice by the provided apps.
  for (String optionalJerseyClass : new String[] {
        "org.glassfish.jersey.message.DeflateEncoder",
        "org.glassfish.jersey.message.GZipEncoder",
        "org.glassfish.jersey.server.filter.EncodingFilter"}) {
    if (ClassUtils.classExists(optionalJerseyClass)) {
      classes.add(ClassUtils.loadClass(optionalJerseyClass));
    }
  }
  log.debug("Found JAX-RS resources: {}", classes);
  return classes;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号