Spring Boot嵌入式Tomcat:如何在集成测试中使用Tomcat 7?

时间:2016-09-14 12:01:33

标签: tomcat spring-boot

我正在开发Spring Boot 1.4 应用程序,我正在为我的Rest端点编写集成测试。 我正在使用新的测试注释,如下所示:

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, properties = {"server.port=8443"})

测试运行时,Spring Boots启动Tomcat 8.5.4。我想使用Tomcat 7.有没有办法强制更改嵌入式Tomcat的版本?

1 个答案:

答案 0 :(得分:0)

是的,您可以使用Tomcat 7.您需要向<tomcat.version>7.0.59</tomcat.version> 添加依赖项并设置属性:

-(void)captureimages
{
  counter++;
  if (counter<4)
  {
 [self.camera capture:^(LLSimpleCamera *camera, UIImage *image,NSDictionary *metadata, NSError *error) {
    if(!error) 
    {
        animationView1.hidden = YES;
        [imageArray addObject:image];
        [self performSelector:@selector(captureimages) withObject:self afterDelay:1.0 ];
    }
     else 
    {
        NSLog(@"An error has occured: %@", error);
    }
}
exactSeenImage:YES];
    [self dismissModalViewControllerAnimated:YES];
    NSArray *animationArray=[NSArray arrayWithArray:imageArray];
    animationView.animationImages=animationArray;
    animationView.animationDuration=3;
    animationView.animationRepeatCount=0;
    [animationView startAnimating];
}
else
{
 animationView.hidden = NO;
    [self.camera.view removeFromSuperview];
    [self.camera removeFromParentViewController];
    view1.hidden = YES;
}
}

更多详情.flatMap