麻烦请大佬们看一下springboot-javafx-support 2.1.6+springboot 2.1.4.RELEASE+jdk1.8架构的项目,springboot-javafx-support库中没有spring.factories文件;导致打包不能运行

org.example
pingrong-client-mes-project
1.0-SNAPSHOT

UTF-8 1.8 ${java.version} 2.1.4.RELEASE 2.1.6 org.springframework.boot spring-boot-starter-actuator ${spring.boot.version} compile org.springframework.boot spring-boot-starter ${spring.boot.version} compile org.springframework.boot spring-boot-starter-log4j2 ${spring.boot.version} compile org.springframework.boot spring-boot-starter-test ${spring.boot.version} compile de.roskenet springboot-javafx-support ${springboot-javafx-support.version} org.mybatis.spring.boot mybatis-spring-boot-starter 1.1.1 compile org.mybatis.generator mybatis-generator-core 1.3.5 compile com.microsoft.sqlserver mssql-jdbc 6.4.0.jre7 compile com.alibaba druid 1.1.10 compile com.alibaba fastjson 1.2.76 compile com.fazecast jSerialComm 2.6.2 compile
    <!-- 这种打包方式,是整体打包把javafx和springboot都包含在一起-->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.5.5</version>
        <configuration>
            <archive>
                <manifest>
                    <mainClass>com.pingrong.mes.PingrongMesApplication</mainClass>
                </manifest>
            </archive>
            <descriptorRefs>
                <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
        </configuration>
        <executions>
            <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>  <!--把全部配置打包成单一jar -->
                </goals>
            </execution>
        </executions>
    </plugin>

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring.boot.version}</version>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>

启动Spring Boot应用程序的代码中有一个bug,这意味着线程上下文类装入器是应用程序类装入器,而不是Spring Boot的类装入器。你可以这样修复它:

CompletableFuture.supplyAsync(() → {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
return SpringApplication.run(this.getClass(), savedArgs);
})

应该改成上面样子,代码是springboot-javafx-suppot 2.1.6这个包的AbstractJavaFxApplicationSupport.java处96行
这个该项目的源码:

还有就是,有问题去stackoverflow上去提,或者去看看依赖的源码项目

1 个赞

感谢大佬的帮助