1. 程式人生 > >Spring Boot有四大神器之actuator

Spring Boot有四大神器之actuator

Spring Boot有四大神器,分別是auto-configuration、starters、cli、actuator,本文主要講actuator。actuator是spring boot提供的對應用系統的自省和監控的整合功能,可以對應用系統進行配置檢視、相關功能統計等。

使用actuator

  • 新增依賴

       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId
>
</dependency>

主要暴露的功能

HTTP方法 路徑 描述 鑑權
GET /autoconfig 檢視自動配置的使用情況 true
GET /configprops 檢視配置屬性,包括預設配置 true
GET /beans 檢視bean及其關係列表 true
GET /dump 列印執行緒棧 true
GET /env 檢視所有環境變數 true
GET /env/{name} 檢視具體變數值 true
GET /health 檢視應用健康指標 false
GET /info 檢視應用資訊 false
GET /mappings 檢視所有url對映 true
GET /metrics 檢視應用基本指標 true
GET /metrics/{name} 檢視具體指標 true
POST /shutdown 關閉應用 true
GET /trace 檢視基本追蹤資訊 true

/autoconfig

{
    "positiveMatches": {
        "AuditAutoConfiguration.AuditEventRepositoryConfiguration": [
            {
                "condition": "OnBeanCondition", 
                "message": "@ConditionalOnMissingBean (types: org.springframework.boot.actuate.audit.AuditEventRepository; SearchStrategy: all) found no beans"
} ] }, "negativeMatches": { "CacheStatisticsAutoConfiguration": [ { "condition": "OnBeanCondition", "message": "@ConditionalOnBean (types: org.springframework.cache.CacheManager; SearchStrategy: all) found no beans" } ] } }

/configprops

{
    "management.health.status.CONFIGURATION_PROPERTIES": {
        "prefix": "management.health.status", 
        "properties": {
            "order": null
        }
    }, 
    "multipart.CONFIGURATION_PROPERTIES": {
        "prefix": "multipart", 
        "properties": {
            "enabled": false, 
            "maxRequestSize": "10Mb", 
            "location": null, 
            "fileSizeThreshold": "0", 
            "maxFileSize": "1Mb"
        }
    }, 
    "environmentEndpoint": {
        "prefix": "endpoints.env", 
        "properties": {
            "id": "env", 
            "enabled": true, 
            "sensitive": true
        }
    }
}

/beans

[
    {
        "context": "application:8080", 
        "parent": null, 
        "beans": [
            {
                "bean": "appMain", 
                "scope": "singleton", 
                "type": "com.xixicat.AppMain$$EnhancerBySpringCGLIB$$29382b14", 
                "resource": "null", 
                "dependencies": [ ]
            }, 
            {
                "bean": "videoInfoMapper", 
                "scope": "singleton", 
                "type": "com.xixicat.dao.VideoInfoMapper", 
                "resource": "file [/Users/xixicat/workspace/video-uber/target/classes/com/xixicat/dao/VideoInfoMapper.class]", 
                "dependencies": [
                    "sqlSessionFactory"
                ]
            }
        ]
    }
]

/dump

[
    {
        "threadName": "Signal Dispatcher", 
        "threadId": 4, 
        "blockedTime": -1, 
        "blockedCount": 0, 
        "waitedTime": -1, 
        "waitedCount": 0, 
        "lockName": null, 
        "lockOwnerId": -1, 
        "lockOwnerName": null, 
        "inNative": false, 
        "suspended": false, 
        "threadState": "RUNNABLE", 
        "stackTrace": [ ], 
        "lockedMonitors": [ ], 
        "lockedSynchronizers": [ ], 
        "lockInfo": null
    }, 
    {
        "threadName": "Reference Handler", 
        "threadId": 2, 
        "blockedTime": -1, 
        "blockedCount": 217, 
        "waitedTime": -1, 
        "waitedCount": 9, 
        "lockName": "[email protected]", 
        "lockOwnerId": -1, 
        "lockOwnerName": null, 
        "inNative": false, 
        "suspended": false, 
        "threadState": "WAITING", 
        "stackTrace": [
            {
                "methodName": "wait", 
                "fileName": "Object.java", 
                "lineNumber": -2, 
                "className": "java.lang.Object", 
                "nativeMethod": true
            }, 
            {
                "methodName": "wait", 
                "fileName": "Object.java", 
                "lineNumber": 503, 
                "className": "java.lang.Object", 
                "nativeMethod": false
            }, 
            {
                "methodName": "run", 
                "fileName": "Reference.java", 
                "lineNumber": 133, 
                "className": "java.lang.ref.Reference$ReferenceHandler", 
                "nativeMethod": false
            }
        ], 
        "lockedMonitors": [ ], 
        "lockedSynchronizers": [ ], 
        "lockInfo": {
            "className": "java.lang.ref.Reference$Lock", 
            "identityHashCode": 73263429
        }
    }
]

/env

{
  profiles: [],
  server.ports: {
    local.server.port: 8080
  },
  servletContextInitParams: {},
  systemProperties: {
    java.runtime.name: "Java(TM) SE Runtime Environment",
      sun.boot.library.path: "/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib",
      java.vm.version: "24.79-b02",
      gopherProxySet: "false",
      maven.multiModuleProjectDirectory: "/Users/xixicat/workspace/video-uber",
      java.vm.vendor: "Oracle Corporation",
      java.vendor.url: "http://java.oracle.com/",
      guice.disable.misplaced.annotation.check: "true",
      path.separator: ":",
      java.vm.name: "Java HotSpot(TM) 64-Bit Server VM",
      file.encoding.pkg: "sun.io",
      user.country: "CN",
      sun.java.launcher: "SUN_STANDARD",
      sun.os.patch.level: "unknown",
      PID: "763",
      java.vm.specification.name: "Java Virtual Machine Specification",
      user.dir: "/Users/xixicat/workspace/video-uber",
      java.runtime.version: "1.7.0_79-b15",
      java.awt.graphicsenv: "sun.awt.CGraphicsEnvironment",
      java.endorsed.dirs: "/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/endorsed",
      os.arch: "x86_64",
      java.io.tmpdir: "/var/folders/tl/xkf4nr61033gd6lk5d3llz080000gn/T/",
      line.separator: " ",
      java.vm.specification.vendor: "Oracle Corporation",
      os.name: "Mac OS X",
      classworlds.conf: "/Users/xixicat/devtool/maven-3.3.3/bin/m2.conf",
      sun.jnu.encoding: "UTF-8",
      spring.beaninfo.ignore: "true",
      java.library.path: "/Users/xixicat/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.",
      java.specification.name: "Java Platform API Specification",
      java.class.version: "51.0",
      sun.management.compiler: "HotSpot 64-Bit Tiered Compilers",
      os.version: "10.10.5",
      user.home: "/Users/xixicat",
      user.timezone: "Asia/Shanghai",
      java.awt.printerjob: "sun.lwawt.macosx.CPrinterJob",
      file.encoding: "UTF-8",
      java.specification.version: "1.7",
      java.class.path: "/Users/xixicat/devtool/maven-3.3.3/boot/plexus-classworlds-2.5.2.jar",
      user.name: "xixicat",
      java.vm.specification.version: "1.7",
      sun.java.command: "org.codehaus.plexus.classworlds.launcher.Launcher spring-boot:run",
      java.home: "/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre",
      sun.arch.data.model: "64",
      user.language: "zh",
      java.specification.vendor: "Oracle Corporation",
      awt.toolkit: "sun.lwawt.macosx.LWCToolkit",
      java.vm.info: "mixed mode",
      java.version: "1.7.0_79",
      java.ext.dirs: "/Users/xixicat/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java",
      sun.boot.class.path: "/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre/classes",
      java.awt.headless: "true",
      java.vendor: "Oracle Corporation",
      maven.home: "/Users/xixicat/devtool/maven-3.3.3",
      file.separator: "/",
      LOG_EXCEPTION_CONVERSION_WORD: "%wEx",
      java.vendor.url.bug: "http://bugreport.sun.com/bugreport/",
      sun.io.unicode.encoding: "UnicodeBig",
      sun.cpu.endian: "little",
      sun.cpu.isalist: ""
  },
  systemEnvironment: {
    TERM: "xterm-256color",
    ZSH: "/Users/xixicat/.oh-my-zsh",
    GVM_BROKER_SERVICE: "http://release.gvm.io",
    GRIFFON_HOME: "/Users/xixicat/.gvm/griffon/current",
    JAVA_MAIN_CLASS_763: "org.codehaus.plexus.classworlds.launcher.Launcher",
    JAVA_HOME: "/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home",
    SHLVL: "1",
    MAVEN_CMD_LINE_ARGS: " spring-boot:run",
    __CF_USER_TEXT_ENCODING: "0x1F5:0x19:0x34",
    GROOVY_HOME: "/Users/xixicat/.gvm/groovy/current",
    XPC_FLAGS: "0x0",
    GVM_INIT: "true",
    JBAKE_HOME: "/Users/xixicat/.gvm/jbake/current",
    PWD: "/Users/xixicat/workspace/video-uber",
    GVM_DIR: "/Users/xixicat/.gvm",
    GVM_VERSION: "2.4.3",
    MAVEN_PROJECTBASEDIR: "/Users/xixicat/workspace/video-uber",
    LOGNAME: "xixicat",
    SSH_AUTH_SOCK: "/private/tmp/com.apple.launchd.93xr1duECQ/Listeners",
    SPRINGBOOT_HOME: "/Users/xixicat/.gvm/springboot/current",
    GAIDEN_HOME: "/Users/xixicat/.gvm/gaiden/current",
    LAZYBONES_HOME: "/Users/xixicat/.gvm/lazybones/current",
    OLDPWD: "/Users/xixicat/workspace/video-uber",
    SHELL: "/bin/zsh",
    JBOSSFORGE_HOME: "/Users/xixicat/.gvm/jbossforge/current",
    LC_CTYPE: "zh_CN.UTF-8",
    TMPDIR: "/var/folders/tl/xkf4nr61033gd6lk5d3llz080000gn/T/",
    GVM_SERVICE: "http://api.gvmtool.net",
    GVM_PLATFORM: "Darwin",
    CLASSPATH: ".:/Users/xixicat/.m2/repository/co/paralleluniverse/quasar-core/0.7.2/quasar-core-0.7.2.jar",
    GLIDE_HOME: "/Users/xixicat/.gvm/glide/current",
    PATH: "/Users/xixicat/.gvm/vertx/current/bin:/Users/xixicat/.gvm/springboot/current/bin:/Users/xixicat/.gvm/lazybones/current/bin:/Users/xixicat/.gvm/jbossforge/current/bin:/Users/xixicat/.gvm/jbake/current/bin:/Users/xixicat/.gvm/groovyserv/current/bin:/Users/xixicat/.gvm/groovy/current/bin:/Users/xixicat/.gvm/griffon/current/bin:/Users/xixicat/.gvm/grails/current/bin:/Users/xixicat/.gvm/gradle/current/bin:/Users/xixicat/.gvm/glide/current/bin:/Users/xixicat/.gvm/gaiden/current/bin:/Users/xixicat/.gvm/crash/current/bin:/Users/xixicat/.gvm/asciidoctorj/current/bin:/Users/xixicat/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/Users/xixicat/devtool/maven-3.3.3/bin:/Users/xixicat/devtool/gradle-2.6/bin:/Users/xixicat/devtool/android-sdk/platform-tools",
    GRADLE_HOME: "/Users/xixicat/.gvm/gradle/current",
    GROOVYSERV_HOME: "/Users/xixicat/.gvm/groovyserv/current",
    GRAILS_HOME: "/Users/xixicat/.gvm/grails/current",
    USER: "xixicat",
    LESS: "-R",
    PAGER: "less",
    HOME: "/Users/xixicat",
    CRASH_HOME: "/Users/xixicat/.gvm/crash/current",
    XPC_SERVICE_NAME: "0",
    VERTX_HOME: "/Users/xixicat/.gvm/vertx/current",
    GVM_BROADCAST_SERVICE: "http://cast.gvm.io",
    Apple_PubSub_Socket_Render: "/private/tmp/com.apple.launchd.y6fNwP8Sk6/Render",
    LSCOLORS: "Gxfxcxdxbxegedabagacad",
    ASCIIDOCTORJ_HOME: "/Users/xixicat/.gvm/asciidoctorj/current"
  },
  applicationConfig: [classpath: /application.properties]: {
    pool.acquireIncrement: "1",
    pool.minPoolSize: "5",
    pool.initialPoolSize: "1",
    database.username: "root",
    pool.maxIdleTime: "60",
    database.url: "jdbc:mysql://127.0.0.1:3307/video_uber?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull",
    spring.jackson.dateFormat: "yyyy-MM-dd'T'HH:mm:ss",
    database.slave.username: "root",
    spring.jackson.serialization.write - dates - as - timestamps: "false",
    pool.idleTimeout: "30000",
    database.slave.url: "jdbc:mysql://127.0.0.1:3307/demo?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull",
    server.port: "8080",
    database.slave.password: "******",
    database.password: "******",
    database.driverClassName: "com.mysql.jdbc.Driver",
    pool.maxPoolSize: "50",
    database.dataSourceClassName: "com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
  }
}

/health

{
  status: "UP",
  diskSpace: {
    status: "UP",
    total: 249779191808,
    free: 193741590528,
    threshold: 10485760
  },
  db: {
    status: "UP",
    database: "MySQL",
    hello: 1
  }
}

/info

需要自己在application.properties裡頭新增資訊,比如

info:
  contact:
    email: xixicat@gmail.com
    phone: 0755-82890987

然後請求就可以出來了

{
  "contact": {
     "phone": "0755-82890987",
     "email": "[email protected]"
  }
}

/mappings

     {
        {
          [/metrics || /metrics.json], methods = [GET], produces = [application / json]
        }: {
          bean: "endpointHandlerMapping",
          method: "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()"
        }, {
          [/beans || /beans.json], methods = [GET], produces = [application / json]
        }: {
          bean: "endpointHandlerMapping",
          method: "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()"
        }, {
          [/health || /health.json], produces = [application / json]
        }: {
          bean: "endpointHandlerMapping",
          method: "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)"
        }, {
          [/info || /info.json], methods = [GET], produces = [application / json]
        }: {
          bean: "endpointHandlerMapping",
          method: "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()"
        }, {
          [/trace || /trace.json], methods = [GET], produces = [application / json]
        }: {
          bean: "endpointHandlerMapping",
          method: "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()"
        }, {
          [/autoconfig || /autoconfig.json], methods = [GET], produces = [application / json]
        }: {
          bean: "endpointHandlerMapping",
          method: "public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()"
        }
      }

/metrics

{
mem: 499404,
mem.free: 257591,
processors: 8,
instance.uptime: 4284997,
uptime: 4294909,
systemload.average: 1.84521484375,
heap.committed: 437248,
heap.init: 262144,
heap.used: 179656,
heap: 3728384,
nonheap.committed: 62848,
nonheap.init: 24000,
nonheap.used: 62156,
nonheap: 133120,
threads.peak: 18,
threads.daemon: 6,
threads.totalStarted: 176,
threads: 16,
classes: 10294,
classes.loaded: 10294,
classes.unloaded: 0,
gc.ps_scavenge.count: 11,
gc.ps_scavenge.time: 405,
gc.ps_marksweep.count: 0,
gc.ps_marksweep.time: 0,
datasource.primary.active: 0,
datasource.primary.usage: 0,
counter.status.200.autoconfig: 1,
counter.status.200.beans: 1,
counter.status.200.configprops: 1,
counter.status.200.dump: 1,
counter.status.200.env: 1,
counter.status.200.health: 1,
counter.status.200.info: 1,
counter.status.200.mappings: 1,
gauge.response.autoconfig: 81,
gauge.response.beans: 15,
gauge.response.configprops: 105,
gauge.response.dump: 76,
gauge.response.env: 4,
gauge.response.health: 43,
gauge.response.info: 1,
gauge.response.mappings: 4
}

/shutdown

要真正生效,得配置檔案開啟

endpoints.shutdown.enabled: true

/trace

記錄最近100個請求的資訊

[{
  "timestamp": 1452955704922,
  "info": {
    "method": "GET",
    "path": "/metrics",
    "headers": {
      "request": {
        "Accept - Encoding": "gzip, deflate, sdch",
          "Upgrade - Insecure - Requests": "1",
          "Accept - Language": "zh-CN,zh;q=0.8,en;q=0.6",
          "User - Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36",
          "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
          "Connection": "keep-alive",
          "Host": "localhost:8080"
      },
      "response": {
        "Content - Type": "application/json; charset=UTF-8",
          "X - Application - Context": "application:8080",
          "Date": "Sat, 16 Jan 2016 14:48:24 GMT",
          "status": "200"
      }
    }
  }
}, {
  "timestamp": 1452951489549,
  "info": {
    "method": "GET",
    "path": "/autoconfig",
    "headers": {
      "request": {
        "Accept - Encoding": "gzip, deflate, sdch",
          "Upgrade - Insecure - Requests": "1",
          "Accept - Language": "zh-CN,zh;q=0.8,en;q=0.6",
          "User - Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36",
          "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
          "Connection": "keep-alive",
          "Host": "localhost:8080"
      },
      "response": {
        "Content - Type": "application/json; charset=UTF-8",
          "X - Application - Context": "application:8080",
          "Date": "Sat, 16 Jan 2016 13:38:09 GMT",
          "status": "200"
      }
    }
  }
}]

相關推薦

Spring Boot四大神器actuator

序 Spring Boot有四大神器,分別是auto-configuration、starters、cli、actuator,本文主要講actuator。actuator是spring boot提供的對應用系統的自省和監控的整合功能,可以對應用系統進行配置檢視、相關功能統計

SpringBoot四大神器Actuator

", java.vm.name: "Java HotSpot(TM) 64-Bit Server VM", file.encoding.pkg: "sun.io", user.country: "CN", sun.java.launcher: "SUN_STAN

系統監控-SpringBoot四大神器Actuator

1. 為什麼要使用Actuator來監控SpringBoot專案? 首先之前部落格提到過使用JDK自帶的JVM監控工具、Psi-

spring boot 監控與管理(actuator

依賴 操作 上下 -1 star oms blog start 技術分享 Spring POMs 中提供了一個特殊的依賴模塊,即spring-boot-starter-actuator,我們只需要在我們的POM中添加依賴即可 <!-- 監控 管理 --> &l

詳解Spring Boot配置文件多環境配置

多個 提高效率 橫線 文件 style ica property form blog 一. 多環境配置的好處: 1.不同環境配置可以配置不同的參數~ 2.便於部署,提高效率,減少出錯~ 二. properties多環境配置 1. 配置激活選項 spring.profile

spring boot 強大的神器

依賴 follow tom ng- 很多 我們 報錯 代碼生成 固定 跟spring有10年的淵源了,最開始使用spring,之後spring mvc,手工配置非常多,稍微漏掉啥 準報錯,查問題都得半天。最近看了下spring新版spring-boot ,它只需我們很少配置

Spring Boot】(24)、Spring Boot中使用快取Spring快取

1、快取依賴 只要新增如下依賴,即可使用快取功能。 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter

spring-boot-2.0.3redis快取實現,不是你想的那樣哦!

前言   開心一刻     小白問小明:“你前面有一個5米深的坑,裡面沒有水,如果你跳進去後該怎樣出來了?”小明:“躺著出來唄,還能怎麼出來?”小白:“為什麼躺著出來?”小明:“5米深的坑,還沒有水,跳下去不死就很幸運了,殘是肯定會殘的,不躺著出來,那能怎麼出來?”小白:“假設沒死也沒殘呢?”小明:“你當

spring-boot-2.0.3redis快取實現,不是你想的那樣哦

前言  開心一刻     小白問小明:“你前面有一個5米深的坑,裡面沒有水,如果你跳進去後該怎樣出來了?”小明:“躺著出來唄,還能怎麼出來?”小白:“為什麼躺著出來?”小明:“5米深的坑,還沒有水,跳下去不死就很幸運了,殘是肯定會殘的,不躺著出來,那能怎麼出來?”小白:“假設沒死也沒殘呢?”小明:“你當我超

Spring Boot Http通訊資料加解密

1、應用背景     Spring Boot開發基於restful型別的API,我們再處理JSON請求時通常使用@RequestBody和@ResponseBody註解, 針對HTTP JSON請求需要解密和返回的JSON資料我們經常需要對資料進行加密

Spring Boot 揭祕與實戰RabbitMQ

Spring Boot 整合 RabbitMQ Spring Boot 整合 RabbitMQ 是非常容易,只需要兩個步驟。 首先,在 pom.xml 中增加 RabbitMQ 依賴。 <dependency> <groupId>

關於SSM與Spring boot何區別?

spring boot是什麼?有什麼作用?什麼場景下使用? SSM是什麼?有什麼作用?什麼場景下使用? 兩個相比較,各自的優缺點 什麼是Spring Boot? 從本質上來說,Spring Boot就是Spring,它做了那些沒有它你也會去做的Spring Bean配

spring boot 使用ssm框架登入

Spring Boot 開發Spring Boot的主要動機是簡化配置和部署spring應用程式的過程。 Spring Boot的主要特點: 建立獨立的Spring應用程式 直接嵌入Tomcat,Jetty或Undertow(無需部署WAR檔案) 提供“初始”的PO

Mybatis四大神器三-刪除

現在學習Mybatis的刪除操作,步驟如下所示: 1.首先,在bao包中”TUser.java”介面新添刪除程式碼,程式碼如下: public int DeleteHuser(int id); 2.在entity包中“HUser.xml”中新添刪除欄位

103. Spring Boot Freemarker特別篇contextPath【從零開始學Spring Boot

需求緣起:有人在群裡@我:請教群主大神一個問題,spring boot  + freemarker 怎麼獲取contextPath 頭疼死我了,網上沒一個靠譜的 。我就看看之前部落格中的 【Spring Boot使用模板freemarker】好像確實沒有介紹到在.ftl檔案

Spring Boot 2.0.6配置Actuator以及跟ehcache-core低版本共存問題(net/sf/ehcache/statistics/StatisticsGateway)

我們新的開發平臺基於spring boot 2.0.6搭建(還未整體使用spring cloud)添加了Spring Boot 2.0.6的actuator後,開發平臺碰到了這個問題描述: java.lang.NoSuchMethodError: net.sf.ehcache.Ehcache

Spring Boot專案通用功能《通用Mapper》

前言 接下來這幾篇文章中我們主要說說,在我們的專案中會使用哪些通用的功能,例如:通用Mapper(mybatis框架的)、通用service和分頁功能等等,這些通用功能的使用會大大降低我們的開發時間,也會讓我們的程式碼變得更加有規範更加合理,今天這篇文章我們說

Spring boot+ Mybatis 完美整合註解版

開發環境: 開發工具:Intellij IDEA 2017.1.3JDK : 1.8.0_101spring boot 版本 : 1.5.8.RELEASEmaven : 3.3.9 拓展: springboot 整合 Mybatis 事務管理 開始 1.新建一個spr

Spring boot系列--redis使用1

簡介 在網際網路的應用中,redis被廣泛地使用。而在spring boot中使用redis,是非常簡單的。 spring boot 中的redis 要在spring boot中使用redis,在pom中加入spring-boot-starter-re

Spring Boot學習(十四)Spring boot中使用QQ郵箱傳送郵件

相信使用過Spring的眾多開發者都知道Spring提供了非常好用的JavaMailSender介面實現郵件傳送。在Spring Boot的Starter模組中也為此提供了自動化配置。下面通過例項看看如