不晓得大家有没有遇到这种情况,目前这个问题已经解决了,但是我写这篇文的目的是想找到为啥这样做可以解决,
这样做的原因是什么?
求大神解答这个究竟是怎么一回事?
最近在github克隆一个spring-boot的项目:halo
个人博客系统:
HALO源码链接
喜欢的朋友可以自己clone下来玩玩
我是3月29号晚上clone下来的,也跑起来了,具体细节就不说了。
以下是前端页面
后台管理页面:
跑起来之后,我随便写了个博客,挺开心的,然后就睡觉去了。
但是,第二天早上,再启动项目,居然启动不起来了
附上报错的信息:
2020-03-30 21:30:52.399 WARN 222768 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'adminAuthenticationFilter' defined in file [D:\workspace\halo\out\production\classes\run\halo\app\security\filter\AdminAuthenticationFilter.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'haloConfiguration': Unsatisfied dependency expressed through field 'buildProperties'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.info.BuildProperties' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2020-03-30 21:30:52.408 INFO 222768 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-03-30 21:30:52.522 ERROR 222768 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field buildProperties in run.halo.app.config.HaloConfiguration required a bean of type 'org.springframework.boot.info.BuildProperties' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'buildProperties' in 'ProjectInfoAutoConfiguration' not loaded because @ConditionalOnResource did not find resource '${spring.info.build.location:classpath:META-INF/build-info.properties}'
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.boot.info.BuildProperties' in your configuration.
Process finished with exit code 0
总结下:
类似找不到这个东西
@ConditionalOnResource did not find resource '${spring.info.build.location:classpath:META-INF/build-info.properties}'
如图:求助李总找到的地方
@ConditionalOnResource(resources = "${spring.info.build.location:classpath:META-INF/build-info.properties}")
因为没有学习也极少接触spring-boot
看到报错类似有什么bean 无发注入,于是类比ssm框架,应该是某些注解没加导致bean生成失败之类
于是找spring-boot是如果注入bean的,百度了好久都无效。
于是产生怀疑,回想昨晚睡觉前到底干了些什么?
明明是啥也没做的啊!!
奇了怪了?
快到抓狂的地步了,所以说程序员一定需要能耐下心来的才能走的更远,这一块我比较弱。
没办法,求助李总,我的一个大学同学。
后来被李总搞定了。
**重点来了:针对此问题的解决办法
说下李总是怎么解决的
第一步:bulid这个地方一下
会生成一个这个东西
下面是这个文件build-info.properties的具体内容
不晓得这个东西是干嘛的
build.artifact=halo
build.group=run.halo.app
build.name=halo
build.time=2020-03-30T13\:41\:12.743Z
build.version=1.3.1
然后直接启动这个地方(下图红框)
就没有报错了,项目正常启动。
实在是无奈!!!!!
刚down下来项目,各种插件配置都OK了
之前启动的是这个地方:--------- application
现在用这个启动还报上面的错。
但是,现在却启动这个东西了
halo【bootRun】
不晓得大家有没有遇到这种情况,目前这个问题已经解决了,但是我写这篇文的目的是想找到为啥这样做可以解决,
这样做的原因是什么?
求大神解答这个究竟是怎么一回事?
老铁看图—>