Skip to content

Commit

Permalink
第 2 章《Spring Boot 配置》Demo
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLi1993 authored and liqiangqiang committed Dec 28, 2017
1 parent 26dfbfc commit fe3c3ff
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
12 changes: 10 additions & 2 deletions chapter-2-spring-boot-config/pom.xml
Expand Up @@ -30,6 +30,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- 自定义 swagger2 Starter 组件依赖 -->
<dependency>
<groupId>com.spring4all</groupId>
<artifactId>spring-boot-starter-swagger</artifactId>
<version>1.5.1.RELEASE</version>
</dependency>

<!-- 测试依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -41,12 +48,13 @@

<build>
<plugins>
<!-- Spring Boot Maven 插件
<!-- Spring Boot Maven 插件 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.1.RELEASE</version>
</plugin>
-->

</plugins>
</build>

Expand Down
@@ -1,5 +1,6 @@
package demo.springboot;

import com.spring4all.swagger.EnableSwagger2Doc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

Expand All @@ -8,6 +9,7 @@
*
* Created by bysocket on 26/09/2017.
*/
@EnableSwagger2Doc // 开启 Swagger
@SpringBootApplication
public class ConfigApplication {
public static void main(String[] args) {
Expand Down
@@ -0,0 +1,3 @@
## \u4E66\u4FE1\u606F
demo.book.name=[Spring Boot 2.x Core Action] From Dev
demo.book.writer=BYSocket
@@ -0,0 +1,3 @@
## \u4E66\u4FE1\u606F
demo.book.name=[Spring Boot 2.x Core Action] From Prod
demo.book.writer=BYSocket
@@ -1,3 +1,5 @@
## \u4E66\u4FE1\u606F
demo.book.name='Spring Boot 2.x Core Action'
demo.book.writer=BYSocket
demo.book.name=[Spring Boot 2.x Core Action]
demo.book.writer=BYSocket
demo.book.description=${demo.book.writer}'s${demo.book.name}

Expand Up @@ -21,13 +21,13 @@ public class ConfigApplicationTests {

@Test
public void testBookProperties() {
Assert.assertEquals(bookProperties.getName(),"'Spring Boot 2.x Core Action'");
Assert.assertEquals(bookProperties.getName(),"[Spring Boot 2.x Core Action]");
Assert.assertEquals(bookProperties.getWriter(),"BYSocket");
}

@Test
public void testBookComponent() {
Assert.assertEquals(bookComponent.getName(),"'Spring Boot 2.x Core Action'");
Assert.assertEquals(bookComponent.getName(),"[Spring Boot 2.x Core Action]");
Assert.assertEquals(bookComponent.getWriter(),"BYSocket");
}
}

0 comments on commit fe3c3ff

Please sign in to comment.