unzip -p charles.jar META-INF/MANIFEST.MF
https://blog.csdn.net/isea533/article/details/50278205
https://www.ibm.com/developerworks/cn/java/j-lo-spring-boot/index.html
[actuator] https://www.cnblogs.com/ckp-henu/p/spring-boot-actuator.html
首先是增加了<parent>
增加父pom比較簡單,而且spring-boot-starter-parent包含了大量配置好的依賴管理,在自己項目添加這些依賴的時候不需要寫<version>版本號。
使用父pom雖然簡單,但是有些情況我們已經有父pom,不能直接增加<parent>時,可以通過如下方式:
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.2.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
在我們開發過程中,我們需要經常修改,為了避免重復啟動項目,我們可以啟用熱部署。
Spring-Loaded項目提供了強大的熱部署功能,添加/刪除/修改 方法/字段/接口/枚舉 等代碼的時候都可以熱部署,速度很快,很方便。
想在Spring Boot中使用該功能非常簡單,就是在spring-boot-maven-plugin插件下面添加依賴:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.5.RELEASE</version>
</dependency>
</dependencies>
1
2
3
4
5
6
7
添加以后,通過mvn spring-boot:run啟動就支持熱部署了。
最近在學習java agent,需要在生成的jar包里面的 META-INF/MAINIFEST.MF 必須包含 Premain-Class這個屬性。采用MAVEN的maven-jar-plugin插件完成。
maven-jar-plugin插件默認生成的MAINIFEST.MF文件包含以下幾項:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: ${user.name}
Build-Jdk: ${java.version}
現在要新增一個Premain-Class屬性,配置如下:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
<manifestEntries>
<Premain-Class>
com.xzq.test.PreAgent
</Premain-Class>
</manifestEntries>
</archive>
</configuration>
