java.lang.IllegalArgumentException:在META-INF / spring.factories中找不到自动配置类

时间:2019-12-04 10:41:37

标签: java spring-boot

当我在Openshift上以jar形式运行Spring Boot应用程序时,出现错误“ java.lang.IllegalArgumentException:在META-INF / spring.factories中找不到自动配置类”。为了使其起作用,我需要评论SpringApplication.run(MyApplication.class, args);。我该怎么解决?

下面是我的pom.xml。 “ ha-app-audit-als”是我组织中本地存储库中的一个库。该库仅适用于Opeshift,这就是为什么我需要在那儿运行。我无法在工作站上运行它。我怀疑这可能与我在Openshift上运行其他一些Spring应用程序有关。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>hk.health.common.intf</groupId>
    <artifactId>cims-migration-testals</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>cims-migration-testals</name>
    <description>cims-migration-testals</description>

    <packaging>jar</packaging>

    <properties>
      <maven.compiler.source>1.8</maven.compiler.source>
      <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20190722</version>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>hk.org.ha.audit.paas</groupId>
            <artifactId>ha-app-audit-als</artifactId>
            <version>4.0.0-SNAPSHOT</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/log4j/log4j -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>apache-log4j-extras</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>


    </dependencies>

    <build> 
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
<!--          <version>2.4.1</version> -->
          <configuration>
            <descriptorRefs>
              <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
            <archive>
              <manifest>
                <mainClass>hk.health.common.intf.CimsMigrationTestalsApplication</mainClass>
              </manifest>
            </archive>
          </configuration>
          <executions>
            <execution>
              <id>make-assembly</id>
              <phase>package</phase>
              <goals>
                <goal>single</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>

</project>

0 个答案:

没有答案