美文网首页
Spring Boot第三方库 之 JavaMelody

Spring Boot第三方库 之 JavaMelody

作者: 诺之林 | 来源:发表于2020-01-18 15:56 被阅读0次

    本文的示例代码参考JavaMelodyDemo

    JavaMelody

    spring --version
    # Spring CLI v2.0.6.RELEASE
    
    spring init -b 2.0.6.RELEASE -dweb --build gradle JavaMelodyDemo && cd JavaMelodyDemo
    
    vim build.gradle
    
    dependencies {
        compile group: 'net.bull.javamelody', name: 'javamelody-spring-boot-starter', version: '1.78.0'
        implementation 'org.springframework.boot:spring-boot-starter-web'
        testImplementation 'org.springframework.boot:spring-boot-starter-test'
    }
    
    vim application.properties
    # server.port=7777
    # javamelody.init-parameters.authorized-users=admin:123456
    # javamelody.init-parameters.monitoring-path=/monitor
    
    vim src/main/java/com/example/ApolloDemo/DemoApplication.java
    
    package com.example.JavaMelodyDemo;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.web.bind.annotation.GetMapping;
    import org.springframework.web.bind.annotation.RestController;
    
    @RestController
    @SpringBootApplication
    public class DemoApplication {
    
        public static void main(String[] args) {
            SpringApplication.run(DemoApplication.class, args);
        }
    
        @GetMapping("/test")
        public String test() {
            return "test";
        }
    
    }
    
    ./gradlew bootrun
    
    curl localhost:7777/test
    

    Reference

    相关文章

      网友评论

          本文标题:Spring Boot第三方库 之 JavaMelody

          本文链接:https://www.haomeiwen.com/subject/zbikzctx.html