forked from yudaocode/SpringBoot-Labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YunaiV
committed
Mar 29, 2020
1 parent
fa570f2
commit 02d8edc
Showing
6 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>labx-15</artifactId> | ||
<groupId>cn.iocoder.springboot.labs</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>labx-15-admin-03-demo-application</artifactId> | ||
|
||
<properties> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<spring.boot.version>2.2.4.RELEASE</spring.boot.version> | ||
<spring.cloud.version>Hoxton.SR1</spring.cloud.version> | ||
<spring.cloud.alibaba.version>2.2.0.RELEASE</spring.cloud.alibaba.version> | ||
</properties> | ||
|
||
<!-- | ||
引入 Spring Boot、Spring Cloud、Spring Cloud Alibaba 三者 BOM 文件,进行依赖版本的管理,防止不兼容。 | ||
在 https://dwz.cn/mcLIfNKt 文章中,Spring Cloud Alibaba 开发团队推荐了三者的依赖关系 | ||
--> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>${spring.boot.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-dependencies</artifactId> | ||
<version>${spring.cloud.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.alibaba.cloud</groupId> | ||
<artifactId>spring-cloud-alibaba-dependencies</artifactId> | ||
<version>${spring.cloud.alibaba.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<!-- 实现对 Spring MVC 的自动化配置 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<!-- 实现对 Actuator 的自动化配置 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
|
||
<!-- 引入 Spring Cloud Alibaba Nacos Discovery 相关依赖,将 Nacos 作为注册中心,并实现对其的自动配置 --> | ||
<dependency> | ||
<groupId>com.alibaba.cloud</groupId> | ||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> | ||
</dependency> | ||
|
||
<!-- 实现对 Spring Security 的自动化配置 --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-security</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
14 changes: 14 additions & 0 deletions
14
...-demo-application/src/main/java/cn/iocoder/springcloud/labx15/demo/Demo01Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package cn.iocoder.springcloud.labx15.demo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Demo01Application { | ||
|
||
public static void main(String[] args) { | ||
System.setProperty("server.port", "18081"); // 端口 18081 | ||
SpringApplication.run(Demo01Application.class, args); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...-demo-application/src/main/java/cn/iocoder/springcloud/labx15/demo/Demo02Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package cn.iocoder.springcloud.labx15.demo; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Demo02Application { | ||
|
||
public static void main(String[] args) { | ||
System.setProperty("server.port", "18082"); // 端口 18082 | ||
SpringApplication.run(Demo02Application.class, args); | ||
} | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
labx-15/labx-15-admin-03-demo-application/src/main/resources/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
management: | ||
endpoints: | ||
# Actuator HTTP 配置项,对应 WebEndpointProperties 配置类 | ||
web: | ||
exposure: | ||
include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 | ||
|
||
spring: | ||
application: | ||
name: demo-application # 应用名 | ||
|
||
# Spring Security 配置项,对应 SecurityProperties 配置类 | ||
security: | ||
# 配置默认的 InMemoryUserDetailsManager 的用户账号与密码。 | ||
user: | ||
name: test # 账号 | ||
password: test # 密码 | ||
|
||
cloud: | ||
nacos: | ||
# Nacos 作为注册中心的配置项,对应 NacosDiscoveryProperties 配置类 | ||
discovery: | ||
server-addr: 127.0.0.1:8848 # Nacos 服务器地址 | ||
service: ${spring.application.name} # 注册到 Nacos 的服务名。默认值为 ${spring.application.name}。 | ||
metadata: | ||
user.name: ${spring.security.user.name} # Spring Security 认证账号 | ||
user.password: ${spring.security.user.password} # Spring Security 认证密码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters