一、该问题的重现步骤是什么?
nacos上面正常访问
每个服务需要配置正确的实例url(要能让spring-admin服务端能正常访问的url)
比如我这个实例url配置的就是一个域名(你如果是内网是通的就直接配置你内网的ip就行了)
spring: boot: admin: instance: # 实例url service-base-url: http://${system.ip}:${http.port}?name=${spring.application.name}
还需要在首页加个“/”的controller 不然会报404
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; import org.springblade.core.tenant.annotation.NonDS; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.StringUtil; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * 首页 * * @author yun.can */ @NonDS @RestController @AllArgsConstructor @Tag(name = "index", description = "index") public class HomeController { @GetMapping("/") @Operation(summary = "index", description = "index") public R index(@RequestParam(required = false) String name, HttpServletResponse response) throws IOException { if (StringUtil.isNotBlank(name)) { // 我的逻辑就不展示了 } return R.success("author yun.can"); } }
扫一扫访问 Blade技术社区 移动端