spring boot打包没有将<scope>system</scope>的jar包含进去
<dependency>
<groupId>com.automvc</groupId>
<artifactId>automvc-lib</artifactId>
<version>1.0.58</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/automvc-lib-1.0.58.jar</systemPath>
</dependency>
在获得的jar包里,并没有包含 <scope>system</scope>的jar包.
直接在eclipse运行调试没有问题; 在dos运行就报错了. 没找到systemPath引用的包.
还有可能是提示, 加载的bean有问题.
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'demoRest': Lookup method resolution failed; nested exception is java.lan
g.IllegalStateException: Failed to introspect Class [com.abc.cloud.rest.DemoRest
] from ClassLoader [org.springframework.boot.loader.LaunchedURLClassLoader@6433a
2]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor
.java:289) ~[spring-beans-5.3.19.jar!/:5.3.19]
需要在<artifactId>spring-boot-maven-plugin</artifactId>里添加配置:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>