Browse Source

简化application.properties,使用application.yml配置,简化pom.xml

huangbo 4 years ago
parent
commit
587ca2935a

+ 0 - 24
ipu-rest-scaffold/pom.xml

@ -50,7 +50,6 @@
50 50
		<jdk>1.8</jdk>
51 51
		<junit>4.12</junit>
52 52
		<spring-session.version>1.3.2.RELEASE</spring-session.version>
53
		<nacos.version>0.1.1</nacos.version>
54 53
	</properties>
55 54
56 55
	<dependencies>
@ -76,29 +75,6 @@
76 75
			<artifactId>mongo-java-driver</artifactId>
77 76
			<version>${mongo.java.driver}</version>
78 77
		</dependency>
79
		<!-- 引入nacos服务配置中心 -->
80
		<dependency>
81
			<groupId>com.alibaba.boot</groupId>
82
			<artifactId>nacos-config-spring-boot-starter</artifactId>
83
			<version>${nacos.version}</version>
84
			<exclusions>
85
				<exclusion>
86
					<groupId>com.alibaba.nacos</groupId>
87
					<artifactId>nacos-client</artifactId>
88
				</exclusion>
89
			</exclusions>
90
		</dependency>
91
		<!-- 引入nacos服务注册中心 -->
92
		<dependency>
93
			<groupId>com.alibaba.boot</groupId>
94
			<artifactId>nacos-discovery-spring-boot-starter</artifactId>
95
			<version>${nacos.version}</version>
96
		</dependency>
97
		<dependency>
98
			<groupId>com.alibaba.nacos</groupId>
99
			<artifactId>nacos-client</artifactId>
100
			<version>0.6.2</version>
101
		</dependency>
102 78
	</dependencies>
103 79
104 80
	<build>

+ 8 - 13
ipu-rest-scaffold/src/main/resources/dev/application.properties

@ -1,23 +1,18 @@
1
#设置服务器端口
2
#也可以通过启动命令行参数实现:java -jar myproject.jar --server.port=9084
1
#通过启动命令传参指定端口:java -jar myproject.jar --server.port=8080
3 2
server.port=unknown
3
#context-path默认/
4
server.context-path=/ipu
4 5

5 6
web.root=webapp/
6
#会影响拦截器的配置exclude-mapping
7
spring.application.name=${project.artifactId}
8
#无拦截
7 9
spring.mvc.static-path-pattern=/**
8
#spring.resources.static-locations=file:${web.root}
9 10
spring.resources.static-locations=classpath:/${web.root}
10 11

11
#context-path默认/
12
server.context-path=/ipu
13
#注册DispatcherServlet对应path,亦可通过dispatcherRegistration方法配置
14
#server.servlet-path=/ipu1
12
#session使用默认
13
spring.session.store-type=none
14

15 15
#使用maven中的变量替换
16 16
logging.file=target/logs/${project.artifactId}.log
17
spring.application.name=${project.artifactId}
18

19 17
#查看spring错误日志
20 18
#logging.level.org.springframework=DEBUG
21

22
#session使用默认
23
spring.session.store-type=none

+ 20 - 0
ipu-rest-scaffold/src/main/resources/dev/application.yml

@ -0,0 +1,20 @@
1
server:
2
  context-path: /ipu
3
  #通过启动命令传参指定端口
4
  port: unknown
5
spring:
6
  application:
7
    #使用maven中的变量project.artifactId
8
    name: ${project.artifactId}
9
  mvc:
10
    #无拦截
11
    static-path-pattern: /**
12
  resources:
13
    static-locations: classpath:/${web.root}
14
  session:
15
    #session使用默认
16
    store-type: none
17
web:
18
  root: webapp/
19
logging:
20
  file: target/logs/${project.artifactId}.log