正在显示
4 个修改的文件
包含
105 行增加
和
0 行删除
config/application.properties
0 → 100644
| 1 | + | ||
| 2 | +#服务端口 | ||
| 3 | +server.port=19527 | ||
| 4 | +server.servlet.context-path=${SERVER_CONTEXTPATH:} | ||
| 5 | + | ||
| 6 | +#服务名 | ||
| 7 | +spring.application.name=eukekaCenter | ||
| 8 | + | ||
| 9 | + | ||
| 10 | +#springcloud 注册中心服务配置 | ||
| 11 | +eureka.instance.hostname=${spring.cloud.client.ip-address} | ||
| 12 | +eureka.instance.prefer-ip-address=true | ||
| 13 | +eureka.instance.instance-id=${spring.cloud.client.ipAddress}:${server.port} | ||
| 14 | + | ||
| 15 | +#表示是否将自己注册到Eureka Server,默认为true。由于当前应用就是Eureka Server,故而设置为false。 | ||
| 16 | +eureka.client.register-with-eureka=false | ||
| 17 | +#表示是否从Eureka Server获取注册信息,默认为true。因为这是一个单点的Eureka Server,不需要同步其他的Eureka Server节点的数据,故而设置为false。 | ||
| 18 | +eureka.client.fetch-registry=false | ||
| 19 | +#eureka注册中心服务器地址,设置与Eureka Server交互的地址,查询服务和注册服务都需要依赖这个地址,多个地址可用逗号(英文的)分割。 | ||
| 20 | +eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/ | ||
| 21 | + | ||
| 22 | +#配置注册中心清理无效节点的时间间隔,默认60000毫秒,即60秒。 | ||
| 23 | +eureka.server.eviction-interval-timer-in-ms=5000 | ||
| 24 | +eureka.server.enable-self-preservation=false |
| @@ -53,7 +53,37 @@ | @@ -53,7 +53,37 @@ | ||
| 53 | <groupId>org.springframework.boot</groupId> | 53 | <groupId>org.springframework.boot</groupId> |
| 54 | <artifactId>spring-boot-maven-plugin</artifactId> | 54 | <artifactId>spring-boot-maven-plugin</artifactId> |
| 55 | </plugin> | 55 | </plugin> |
| 56 | + <plugin> | ||
| 57 | + <groupId>org.apache.maven.plugins</groupId> | ||
| 58 | + <artifactId>maven-jar-plugin</artifactId> | ||
| 59 | + <configuration> | ||
| 60 | + <archive> | ||
| 61 | + <manifest> | ||
| 62 | + <addClasspath>true</addClasspath> | ||
| 63 | + <classpathPrefix></classpathPrefix> | ||
| 64 | + <mainClass>com.tianbo.cloud.CloudApplication</mainClass> | ||
| 65 | + </manifest> | ||
| 66 | + </archive> | ||
| 67 | + </configuration> | ||
| 68 | + </plugin> | ||
| 56 | </plugins> | 69 | </plugins> |
| 70 | + <resources> | ||
| 71 | + <resource> | ||
| 72 | + <directory>src/main/resources</directory> | ||
| 73 | + <excludes> | ||
| 74 | + <exclude>**/*.properties</exclude> | ||
| 75 | + <exclude>**/*.yml</exclude> | ||
| 76 | + <exclude>**/*.xml</exclude> | ||
| 77 | + </excludes> | ||
| 78 | + </resource> | ||
| 79 | + <resource> | ||
| 80 | + <directory>lib/</directory> | ||
| 81 | + <targetPath>lib</targetPath> | ||
| 82 | + <includes> | ||
| 83 | + <include>**/*.jar</include> | ||
| 84 | + </includes> | ||
| 85 | + </resource> | ||
| 86 | + </resources> | ||
| 57 | </build> | 87 | </build> |
| 58 | 88 | ||
| 59 | </project> | 89 | </project> |
| 1 | # eureka 注册中心 | 1 | # eureka 注册中心 |
| 2 | + | ||
| 3 | +###### 如果只是想在打成jar包的时候单独把配置文件分离出来,这个其实简单。按照规定,Spring Boot 的配置文件加载优先级如下: | ||
| 4 | +####### springboot的 读取配置文件的顺序 | ||
| 5 | +1. 当前目录下的config子目录 | ||
| 6 | +2. 当前目录 | ||
| 7 | +3. classpath下的config目录 | ||
| 8 | +4. classpath根路径 | ||
| 9 | + | ||
| 10 | +# 打包编译前 把resources里面的所有文件复制到/config文件夹里面 一份,就是将配置文件打包到包外了。部署以后的时候可以修改config文件夹里面的配置文件数据 更新配置 |
src/main/assembly/package.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<assembly | ||
| 3 | + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" | ||
| 4 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 5 | + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> | ||
| 6 | + <id>package</id> | ||
| 7 | + <formats> | ||
| 8 | + <format>zip</format> | ||
| 9 | + </formats> | ||
| 10 | + <includeBaseDirectory>true</includeBaseDirectory> | ||
| 11 | + <fileSets> | ||
| 12 | + <!-- 把项目相关的说明文件,打包进zip文件的根目录 --> | ||
| 13 | + <fileSet> | ||
| 14 | + <directory>${project.basedir}</directory> | ||
| 15 | + <outputDirectory>/</outputDirectory> | ||
| 16 | + <includes> | ||
| 17 | + <include>README*</include> | ||
| 18 | + <include>LICENSE*</include> | ||
| 19 | + <include>NOTICE*</include> | ||
| 20 | + <include>build.info</include> | ||
| 21 | + </includes> | ||
| 22 | + </fileSet> | ||
| 23 | + | ||
| 24 | + <fileSet> | ||
| 25 | + <directory>${project.basedir}/config</directory> | ||
| 26 | + <outputDirectory>config</outputDirectory> | ||
| 27 | + <includes> | ||
| 28 | + <include>*.properties</include> | ||
| 29 | + <include>ireport/*.jasper</include> | ||
| 30 | + </includes> | ||
| 31 | + </fileSet> | ||
| 32 | + | ||
| 33 | + <!-- 把项目自己编译出来的jar文件,打包进zip文件的根目录 --> | ||
| 34 | + <fileSet> | ||
| 35 | + <directory>${project.build.directory}</directory> | ||
| 36 | + <outputDirectory>/</outputDirectory> | ||
| 37 | + <includes> | ||
| 38 | + <include>*.jar</include> | ||
| 39 | + </includes> | ||
| 40 | + </fileSet> | ||
| 41 | + </fileSets> | ||
| 42 | +</assembly> |
-
请 注册 或 登录 后发表评论