File tree 6 files changed +184
-165
lines changed
6 files changed +184
-165
lines changed Original file line number Diff line number Diff line change 11
11
<parent >
12
12
<groupId >org.springframework.boot</groupId >
13
13
<artifactId >spring-boot-starter-parent</artifactId >
14
- <version >2.0 .2.RELEASE</version >
14
+ <version >2.1 .2.RELEASE</version >
15
15
<relativePath />
16
16
</parent >
17
17
54
54
<mysql .version>5.1.29</mysql .version>
55
55
<jackson .version>2.8.5</jackson .version>
56
56
<servlet .version>3.0.1</servlet .version>
57
- <spring .boot.admin.version>2.1.1 </spring .boot.admin.version>
57
+ <spring .boot.admin.version>2.1.2 </spring .boot.admin.version>
58
58
</properties >
59
59
60
60
<dependencies >
107
107
</dependency >
108
108
109
109
<dependency >
110
- <groupId >org.springframework.boot</groupId >
111
- <artifactId >spring-boot-starter-actuator</artifactId >
110
+ <groupId >de.codecentric</groupId >
111
+ <artifactId >spring-boot-admin-starter-client</artifactId >
112
+ <version >${spring.boot.admin.version} </version >
113
+ </dependency >
114
+
115
+ <dependency >
116
+ <groupId >de.codecentric</groupId >
117
+ <artifactId >spring-boot-admin-starter-server</artifactId >
118
+ <version >${spring.boot.admin.version} </version >
112
119
</dependency >
113
120
114
121
<!-- shiro spring. -->
264
271
</dependency >
265
272
</dependencies >
266
273
<configuration >
274
+ <mainClass >com.geekcattle.Application</mainClass >
267
275
<fork >true</fork ><!-- 如果没有该项配置,这个devtools不会起作用,即应用不会restart -->
268
276
</configuration >
269
277
</plugin >
Original file line number Diff line number Diff line change 17
17
18
18
package com .geekcattle ;
19
19
20
+ import de .codecentric .boot .admin .server .config .EnableAdminServer ;
20
21
import org .springframework .boot .SpringApplication ;
21
22
import org .springframework .boot .autoconfigure .SpringBootApplication ;
22
23
import org .springframework .boot .context .properties .EnableConfigurationProperties ;
27
28
@ EnableConfigurationProperties
28
29
@ EnableTransactionManagement
29
30
@ MapperScan ("com.geekcattle.mapper" )
31
+ @ EnableAdminServer
30
32
public class Application {
31
33
//启动文件
32
34
public static void main (String [] args ){
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public class IndexController {
36
36
37
37
@ RequestMapping
38
38
public String index (Model model ) {
39
- return "index" ;
39
+ return "home/ index" ;
40
40
}
41
41
42
42
@ RequestMapping (value = "/test" ,method = {RequestMethod .GET })
Original file line number Diff line number Diff line change 42
42
import org .springframework .context .annotation .Bean ;
43
43
import org .springframework .context .annotation .Configuration ;
44
44
import org .springframework .context .annotation .DependsOn ;
45
+ import org .springframework .core .annotation .Order ;
45
46
import org .springframework .web .filter .DelegatingFilterProxy ;
46
47
47
48
import javax .servlet .Filter ;
@@ -202,6 +203,7 @@ public FilterRegistrationBean filterProxy(){
202
203
* 2、当设置多个过滤器时,全部验证通过,才视为通过
203
204
* 3、部分过滤器可指定参数,如perms,roles
204
205
*/
206
+ @ Order (-1 )
205
207
@ Bean (name = "shiroFilter" )
206
208
public ShiroFilterFactoryBean shiroFilter (DefaultWebSecurityManager securityManager ){
207
209
logger .debug ("ShiroConfiguration.shirFilter()" );
@@ -234,6 +236,8 @@ public ShiroFilterFactoryBean shiroFilter(DefaultWebSecurityManager securityMana
234
236
235
237
//<!-- 过滤链定义,从上向下顺序执行,一般将 /**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了;
236
238
//<!-- authc:所有url都必须认证通过才可以访问; anon:所有url都都可以匿名访问-->
239
+ filterChainDefinitionMap .put ("/monitor/**" , "anon" );
240
+ filterChainDefinitionMap .put ("/error" , "anon" );
237
241
filterChainDefinitionMap .put ("/console/login" , "anon" );
238
242
filterChainDefinitionMap .put ("/console/logout" , "logout" );
239
243
//配置记住我或认证通过可以访问的地址
Original file line number Diff line number Diff line change @@ -10,23 +10,20 @@ server:
10
10
# 日志配置
11
11
logging :
12
12
level :
13
- com.geekcattle.mapper : DEBUG
13
+ com.springframework.boot.web : warn
14
+ com.geekcattl : debug
15
+ de.codecentric.boot.admin : warn
14
16
file : " ${user.home}/logs/spring-boot-logging.log"
15
17
16
18
management :
17
19
endpoints :
18
20
web :
19
21
exposure :
20
22
include : ["*"]
23
+ base-path : /monitor/actuator
21
24
endpoint :
22
- env :
23
- enabled : true
24
25
health :
25
- enabled : true
26
26
show-details : always
27
- info :
28
- enabled : true
29
-
30
27
31
28
spring :
32
29
application :
@@ -52,6 +49,13 @@ spring:
52
49
datasource :
53
50
type : com.alibaba.druid.pool.DruidDataSource
54
51
driver-class-name : com.mysql.jdbc.Driver
52
+ boot :
53
+ admin :
54
+ client :
55
+ url : http://localhost:${server.port}/admin
56
+ instance :
57
+ service-base-url : http://localhost:${server.port}
58
+ context-path : monitor
55
59
# json配置
56
60
jackson :
57
61
time-zone : Asia/Chongqing
@@ -197,6 +201,7 @@ spring:
197
201
host : 127.0.0.1
198
202
port : 6379
199
203
password : Hao123
204
+
200
205
server :
201
206
port : 8000
202
207
j2cache :
You can’t perform that action at this time.
0 commit comments