微服务版后端初始化
This commit is contained in:
89
xjrsoft-admin/pom.xml
Normal file
89
xjrsoft-admin/pom.xml
Normal file
@ -0,0 +1,89 @@
|
||||
<?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>xjrsoft-cloud</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-admin</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
|
||||
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- Admin 服务 -->
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-server</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Admin 界面 -->
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-server-ui</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--引入nacos依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--引入openFeigh 所需要的负载均衡依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.admin;
|
||||
|
||||
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/11/2 16:15
|
||||
*/
|
||||
@EnableAdminServer
|
||||
@SpringBootApplication
|
||||
public class AdminApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AdminApplication.class, args);
|
||||
}
|
||||
}
|
||||
3
xjrsoft-admin/src/main/resources/application.yml
Normal file
3
xjrsoft-admin/src/main/resources/application.yml
Normal file
@ -0,0 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: public
|
||||
62
xjrsoft-admin/src/main/resources/bootstrap.yml
Normal file
62
xjrsoft-admin/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,62 @@
|
||||
server:
|
||||
port: 3000
|
||||
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: admin-service
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
cloud:
|
||||
nacos: #nacos监控
|
||||
discovery:
|
||||
server-addr: 10.0.252.1:8848
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
config:
|
||||
server-addr: 10.0.252.1:8848 # nacos 配置中心地址
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
file-extension: yml # 指定格式 xjrsoft-demo-service-dev.yml
|
||||
extension-configs:
|
||||
- data-id: global-config.yml #导入全局配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: mybatis-plus-config.yml #导入mybatisplus 配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: sa-token-client-config.yml #导入sa-token配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: redis-config.yml #导入redis配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
sentinel:
|
||||
transport:
|
||||
dashboard: localhost:8080 #sentinel dashboard 地址
|
||||
port: 8719 #默认端口, 如果 被占用,会一直+1 直到未被占用为止
|
||||
#使用注册中心后,他admin也可以监控自身服务状况
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
#开放所有页面节点 默认只开启了health、info两个节点
|
||||
include: '*'
|
||||
endpoint:
|
||||
health:
|
||||
#显示健康具体信息 默认不会显示详细信息
|
||||
show-details: always
|
||||
# 利用info端点,加入版本等信息
|
||||
info:
|
||||
version: 1.0.0
|
||||
name: xjrsoft
|
||||
group: com.xjrsoft
|
||||
description: xxxxxx
|
||||
#还可以自定义信息
|
||||
author: Coding Farmer
|
||||
blog: http://www.xjrsoft.com
|
||||
Reference in New Issue
Block a user