mirror of
https://gitee.com/jamen/slife.git
synced 2026-11-02 15:23:40 +00:00
加入spring boot admin 监控,修复群里提出的一些bug
This commit is contained in:
@@ -194,6 +194,10 @@ controller主要负责转发、service主要负责业务逻辑、dao主要是数
|
||||
|
||||

|
||||
|
||||
## Spring Boot Admin 监控
|
||||

|
||||

|
||||
|
||||
|
||||
## Activit工作流
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 93 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 89 KiB |
@@ -44,7 +44,7 @@
|
||||
<module>slife-wx-applet</module>
|
||||
<module>slife-activiti</module>
|
||||
<module>slife-log</module>
|
||||
<module>slife-test</module>
|
||||
<!-- <module>slife-test</module>-->
|
||||
<module>slife-blog</module>
|
||||
</modules>
|
||||
|
||||
@@ -138,10 +138,12 @@
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.slife</groupId>
|
||||
<artifactId>slife-boot-admin</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>slife-boot-admin</name>
|
||||
<description>spring boot admin</description>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.5.9.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-server</artifactId>
|
||||
<version>1.5.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-server-ui</artifactId>
|
||||
<version>1.5.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.slife;
|
||||
|
||||
import de.codecentric.boot.admin.config.EnableAdminServer;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author chen
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableAdminServer
|
||||
public class SlifeBootAdminApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SlifeBootAdminApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
server:
|
||||
port: 8002
|
||||
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: slife-boot-admin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.slife;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class SlifeBootAdminApplicationTests {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,4 +27,8 @@ public class Global {
|
||||
* 树的顶级 节点id
|
||||
*/
|
||||
public static final Long TOP_TREE_NODE = 0L;
|
||||
/**
|
||||
* 管理员id
|
||||
*/
|
||||
public static final Long ADMIN_ID =1L ;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package com.slife.controller;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* Created by chen on 2017/9/28.
|
||||
@@ -17,13 +13,13 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
@Controller
|
||||
@RequestMapping(value = "/test1")
|
||||
public class SysTestController {
|
||||
@Autowired
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
// @Autowired
|
||||
// private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@ResponseBody
|
||||
/* @ResponseBody
|
||||
@GetMapping(value = "/redisTest")
|
||||
public void redisTest(){
|
||||
stringRedisTemplate.opsForValue().set("xxx","dddd");
|
||||
stringRedisTemplate.opsForSet().add("2","x","c");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -53,10 +53,12 @@ public class SysUserController extends BaseController {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/exportUserList")
|
||||
@GetMapping(value = "/exportUserList")
|
||||
@ResponseBody
|
||||
public void exportCollectCustomerList(@RequestBody DataTable dt, HttpServletResponse response) throws Exception {
|
||||
List<SysUser> users = sysUserService.pageSearch(dt).getRows();
|
||||
public void exportCollectCustomerList(HttpServletResponse response) throws Exception {
|
||||
|
||||
|
||||
List<SysUser> users = sysUserService.selectList(null);
|
||||
|
||||
//导出数据
|
||||
String excelTitle = "用户列表";
|
||||
|
||||
@@ -177,7 +177,7 @@ public class SysUser extends CompanyLinkEntity<SysUser> {
|
||||
|
||||
public static boolean isAdmin(Long id) {
|
||||
|
||||
return id != null && "1".equals(id);
|
||||
return id != null && id.equals(Global.ADMIN_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -146,7 +146,8 @@
|
||||
|
||||
|
||||
function dt_explort_buttont() {
|
||||
export_data( getcolumns(), {"createDate": "desc"});
|
||||
|
||||
location.href=url + "exportUserList";
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
<version>1.5.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.drtrang</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
|
||||
@@ -59,6 +59,22 @@ public class ShiroConfig {
|
||||
filterChainDefinitionMap.put("/img/**","anon");
|
||||
filterChainDefinitionMap.put("/fonts/**","anon");
|
||||
|
||||
filterChainDefinitionMap.put("/health/**","anon");
|
||||
filterChainDefinitionMap.put("/env/**","anon");
|
||||
filterChainDefinitionMap.put("/metrics/**","anon");
|
||||
filterChainDefinitionMap.put("/trace/**","anon");
|
||||
filterChainDefinitionMap.put("/dump/**","anon");
|
||||
filterChainDefinitionMap.put("/jolokia/**","anon");
|
||||
filterChainDefinitionMap.put("/info/**","anon");
|
||||
filterChainDefinitionMap.put("/logfile/**","anon");
|
||||
filterChainDefinitionMap.put("/refresh/**","anon");
|
||||
filterChainDefinitionMap.put("/flyway/**","anon");
|
||||
filterChainDefinitionMap.put("/liquibase/**","anon");
|
||||
filterChainDefinitionMap.put("/heapdump/**","anon");
|
||||
filterChainDefinitionMap.put("/loggers/**","anon");
|
||||
filterChainDefinitionMap.put("/auditevents/**","anon");
|
||||
|
||||
|
||||
filterChainDefinitionMap.put("/layouts/**","anon");
|
||||
filterChainDefinitionMap.put("/attach/**","anon");
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class WebSiteMeshFilter extends ConfigurableSiteMeshFilter {
|
||||
/** 需要装饰的访问路径 */
|
||||
|
||||
private String contentPath="/sys/user,/sys/menu,/sys/dict,/sys/role,/sys/office,/sys/,/index,/monitor/*," +
|
||||
"/blog/content**,/404,/model,/process";
|
||||
"/blog/content**,/404,/model,/druid*";
|
||||
|
||||
/** 装饰器页面路径 */
|
||||
|
||||
@@ -23,7 +23,7 @@ public class WebSiteMeshFilter extends ConfigurableSiteMeshFilter {
|
||||
|
||||
/** 不需要装饰的访问路径,多个之间用英文逗号分隔 */
|
||||
|
||||
private String excludedPaths="";
|
||||
private String excludedPaths="*.js,*.css";
|
||||
|
||||
@Override
|
||||
protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) {
|
||||
|
||||
@@ -14,6 +14,13 @@ spring:
|
||||
request-context-attribute: rc
|
||||
charset: UTF-8
|
||||
|
||||
boot:
|
||||
admin:
|
||||
url: http://localhost:8002
|
||||
client:
|
||||
enabled: true
|
||||
|
||||
|
||||
redis:
|
||||
database: 0
|
||||
host: 10.10.20.100
|
||||
@@ -54,8 +61,16 @@ sitemesh:
|
||||
server:
|
||||
port: 8081
|
||||
|
||||
management:
|
||||
security:
|
||||
enabled: false
|
||||
|
||||
|
||||
logging:
|
||||
file: "logs/slife.log"
|
||||
|
||||
logging.level.project.user.UserClient: DEBUG
|
||||
|
||||
mybatis:
|
||||
mapper-locations: classpath:mapper/*.xml
|
||||
type-aliases-package: com.slife.entity
|
||||
@@ -75,3 +90,4 @@ mybatis-plus:
|
||||
security:
|
||||
basic:
|
||||
enabled: false
|
||||
|
||||
|
||||
@@ -116,17 +116,7 @@ function export_data(columns, sorts) {
|
||||
|
||||
});
|
||||
|
||||
|
||||
var from = $("#export");
|
||||
$("input,select").each(function () {
|
||||
if ($(this).attr("name") != undefined) {
|
||||
from.append("<input name='" + $(this).attr("name") + "' value='" + $(this).val() + "'/>");
|
||||
}
|
||||
});
|
||||
from.attr("method", "post");
|
||||
from.attr("action", url + "exportUserList");
|
||||
from.submit();
|
||||
from.empty();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user