1. 添加依赖 <dependency> <groupId>it.geosolutions</groupId> <artifactId>geoserver-manager</artifactId> <version>1.7.0</version> </dependency> 2. 抽取常量 public class GeoConstant { public static String GEOSERVER_URL = "https://localhost:8080/geoserver";