(1) 名字too length ,选择run->eid configration->点开modify options找到shorten command line ,点开下拉选择JAR manifest即可。
(2) 关于引入(@Resource或者@Autowire)使用mapper时,拿不到值,值为null,原因:这个是运行时动态生成的,因此需要在类上加上注解:
@RunWith(SpringRunner.class)
另还需要在类上加上注解: @SpringBootTest
(3) 此时仍然会报错,生成mapper的bean报错:
Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
原因没有关于data数据源的配置,此时需要再在类上加一个注解:@WebAppConfiguration
至此项目可以完全运行起来。
springboot里面Junit测试时出现的各种问题
最新推荐文章于 2024-07-03 12:14:55 发布