java -jar 启动错误 No auto configuration classes found in META-INF/spring.factories

java -jar XX.jar启动报错:

INFO 2019-07-20 22:00:28 org.springframework.boot.SpringApplication.logStartupProfileInfo(675) | No active profile set, falling back to default profiles: default
ERROR 2019-07-20 22:00:28 org.springframework.boot.SpringApplication.reportFailure(858) | Application run failed
java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.factories. If you are using a custom packaging, make sure that file is correct.
at org.springframework.util.Assert.notEmpty(Assert.java:464)
at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getCandidateConfigurations(AutoConfigurationImportSelector.java:183)

解决方法:

pom文件中增加:

<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

注意:

1 这次是用idea右侧模块的lifecycle->package生产模块下的target的jar是可以启动了
2 生成的jar包反编译看下,里面的MANIFEST.MF是否包含Main-Class

不确定:
META-INFO
->MANIFEST.MF
Manifest-Version: 1.0
Main-Class: com.spider.user.provider.MyUserServiceProviderApplication
文件存放位置是否不要放在src/main/java下面(放在根目录)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值