问题

Springboot启动,控制台停在 Parsed mapper file 'file[************mapper.xml]

排查

到源码这个方法的catch打断点,可发现异常

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory

protected Object doCreateBean(final String beanName, final RootBeanDefinition mbd, final @Nullable Object[] args)
      throws BeanCreationException {
    // 省略
	try {
			populateBean(beanName, mbd, instanceWrapper);
			exposedObject = initializeBean(beanName, exposedObject, mbd);
		}
		catch (Throwable ex) {
			if (ex instanceof BeanCreationException && beanName.equals(((BeanCreationException) ex).getBeanName())) {
				throw (BeanCreationException) ex;
			}
			else {
				throw new BeanCreationException(
						mbd.getResourceDescription(), beanName, "Initialization of bean failed", ex);
			}
		}
    
}    

根据实际报错信息解决,比如我的异常如下,少个了配置项

org.springframework.beans.factory.BeanCreationException: Error creating bean with name '***Service': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder '***' in value "${***}"

但是这个为什么没打在控制台呢

发现是logback配置的问题,springProfile是dev时才打在console,修改了以后,就能把报错打在控制台了

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐