test for tomcat

This commit is contained in:
joe 2017-09-28 12:42:59 -06:00
parent 25989ca4ee
commit 945954cb47
2 changed files with 12 additions and 1 deletions

View file

@ -70,6 +70,11 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- Databases - Uses HSQL by default --> <!-- Databases - Uses HSQL by default -->
<dependency> <dependency>

View file

@ -18,6 +18,8 @@ package org.springframework.samples.petclinic;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
/** /**
* PetClinic Spring Boot Application. * PetClinic Spring Boot Application.
@ -26,7 +28,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* *
*/ */
@SpringBootApplication @SpringBootApplication
public class PetClinicApplication { public class PetClinicApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(PetClinicApplication.class);
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
SpringApplication.run(PetClinicApplication.class, args); SpringApplication.run(PetClinicApplication.class, args);