提交 b973caeb 编写于 作者: Z Zeger-Jan van de Weg

Merge branch 'update-to-spring-2' into 'master'

Update to Spring Boot 2

See merge request gitlab-org/project-templates/spring!5
target/ /target/
!.mvn/wrapper/maven-wrapper.jar !.mvn/wrapper/maven-wrapper.jar
### STS ### ### STS ###
...@@ -8,6 +8,7 @@ target/ ...@@ -8,6 +8,7 @@ target/
.project .project
.settings .settings
.springBeans .springBeans
.sts4-cache
### IntelliJ IDEA ### ### IntelliJ IDEA ###
.idea .idea
...@@ -16,9 +17,9 @@ target/ ...@@ -16,9 +17,9 @@ target/
*.ipr *.ipr
### NetBeans ### ### NetBeans ###
nbproject/private/ /nbproject/private/
build/ /build/
nbbuild/ /nbbuild/
dist/ /dist/
nbdist/ /nbdist/
.nb-gradle/ /.nb-gradle/
\ No newline at end of file
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip
### Java Spring template project ### Java Spring template project
This project is based on a GitLab [Project Template](https://docs.gitlab.com/ee/gitlab-basics/create-project.html) This project is based on a GitLab [Project Template](https://docs.gitlab.com/ee/gitlab-basics/create-project.html).
Additions and changes to the project can be proposed in the [original project](https://gitlab.com/gitlab-org/project-templates/spring) Additions and changes to the project can be proposed in the [original project](https://gitlab.com/gitlab-org/project-templates/spring).
### CI/CD with Auto DevOps ### CI/CD with Auto DevOps
This template is compatible with [Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/). This template is compatible with [Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/).
If Auto DevOps is not already enabled for this project, you can [turn it on](https://docs.gitlab.com/ee/topics/autodevops/#enabling-auto-devops) If Auto DevOps is not already enabled for this project, you can [turn it on](https://docs.gitlab.com/ee/topics/autodevops/#enabling-auto-devops) in the project settings.
in the project settings. Otherwise, you can create a custom `.gitlab-ci.yml` file and customize it. Otherwise, you can create a custom `.gitlab-ci.yml` file and customize it.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version> <version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
......
...@@ -3,14 +3,26 @@ package com.example.demo; ...@@ -3,14 +3,26 @@ package com.example.demo;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class DemoApplicationTests { public class DemoApplicationTests {
@Test @Test
public void contextLoads() { public void contextLoads() {
} }
@Autowired
private TestRestTemplate restTemplate;
@Test
public void homeResponse() {
String body = this.restTemplate.getForObject("/", String.class);
assertThat(body).isEqualTo("Spring is here!");
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册