import{_ as c,o as i,c as l,a as n,b as a,w as r,e as s,d as p,r as e}from"./app.977e81c1.js";const u={},d=n("h1",{id:"arthas-spring-boot-starter",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#arthas-spring-boot-starter","aria-hidden":"true"},"#"),s(" Arthas Spring Boot Starter")],-1),k=n("div",{class:"custom-container tip"},[n("p",{class:"custom-container-title"},"TIP"),n("p",null,"Support spring boot 2")],-1),g=s("Latest Version: "),v={href:"https://search.maven.org/search?q=arthas-spring-boot-starter",target:"_blank",rel:"noopener noreferrer"},h=s("View"),m=p(`

Add maven dependency:

        <dependency>
            <groupId>com.taobao.arthas</groupId>
            <artifactId>arthas-spring-boot-starter</artifactId>
            <version>\${arthas.version}</version>
        </dependency>

When the application is started, spring will start arthas and attach its own process.

Configuration properties

For example, by configuring the tunnel server for remote management.

arthas.agent-id=hsehdfsfghhwertyfad
arthas.tunnel-server=ws://47.75.156.201:7777/ws
`,6),b=s("All supported configuration: "),f={href:"https://github.com/alibaba/arthas/blob/master/arthas-spring-boot-starter/src/main/java/com/alibaba/arthas/spring/ArthasProperties.java",target:"_blank",rel:"noopener noreferrer"},_=s("Reference"),w=n("div",{class:"custom-container tip"},[n("p",{class:"custom-container-title"},"TIP"),n("p",null,[s("By default, arthas-spring-boot-starter will disable the "),n("code",null,"stop"),s(" command.")])],-1),y=s("Reference: "),x=s("Arthas Properties"),q=n("h2",{id:"view-endpoint-information",tabindex:"-1"},[n("a",{class:"header-anchor",href:"#view-endpoint-information","aria-hidden":"true"},"#"),s(" View Endpoint Information")],-1),I={class:"custom-container tip"},A=n("p",{class:"custom-container-title"},"TIP",-1),S=s("Need to configure spring boot to expose endpoint: "),j={href:"https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints",target:"_blank",rel:"noopener noreferrer"},N=s("Reference"),B=s("."),M=p(`

Assuming the endpoint port is 8080, it can be viewed via the following url.

http://localhost:8080/actuator/arthas

{
    "arthasConfigMap": {
        "agent-id": "hsehdfsfghhwertyfad",
        "tunnel-server": "ws://47.75.156.201:7777/ws",
    }
}

Non-spring boot application usage

Non-Spring Boot applications can be used in the following ways.

        <dependency>
            <groupId>com.taobao.arthas</groupId>
            <artifactId>arthas-agent-attach</artifactId>
            <version>\${arthas.version}</version>
        </dependency>
        <dependency>
            <groupId>com.taobao.arthas</groupId>
            <artifactId>arthas-packaging</artifactId>
            <version>\${arthas.version}</version>
        </dependency>
import com.taobao.arthas.agent.attach.ArthasAgent;

public class ArthasAttachExample {

	public static void main(String[] args) {
		ArthasAgent.attach();
	}

}

You can also configure properties:

        HashMap<String, String> configMap = new HashMap<String, String>();
        configMap.put("arthas.appName", "demo");
        configMap.put("arthas.tunnelServer", "ws://127.0.0.1:7777/ws");
        ArthasAgent.attach(configMap);

WARNING

Note that the configuration must be camel case, which is different from the - style of spring boot. Only the spring boot application supports both camel case and - style configuration.

`,10);function V(R,E){const t=e("ExternalLinkIcon"),o=e("RouterLink");return i(),l("div",null,[d,k,n("p",null,[g,n("a",v,[h,a(t)])]),m,n("p",null,[b,n("a",f,[_,a(t)])]),w,n("p",null,[y,a(o,{to:"/en/doc/arthas-properties.html"},{default:r(()=>[x]),_:1})]),q,n("div",I,[A,n("p",null,[S,n("a",j,[N,a(t)]),B])]),M])}const P=c(u,[["render",V],["__file","spring-boot-starter.html.vue"]]);export{P as default};