简体   繁体   English

LoggersMvcEndpoint 需要匹配 class。 在 spring-boot 2.1.9 版本中

[英]Need matching class for LoggersMvcEndpoint. in spring-boot 2.1.9 release

I am upgrading my project from spring-boot 1.5.12.release to 2.1.9.release.我正在将我的项目从 spring-boot 1.5.12.release 升级到 2.1.9.release。 I am unable to find LoggersMvcEndpoint ( https://docs.spring.io/spring-boot/docs/1.5.12.RELEASE/api/org/springframework/boot/actuate/endpoint/mvc/LoggersMvcEndpoint.html ) in latest version. I am unable to find LoggersMvcEndpoint ( https://docs.spring.io/spring-boot/docs/1.5.12.RELEASE/api/org/springframework/boot/actuate/endpoint/mvc/LoggersMvcEndpoint.html ) in latest version . In one of my controller I had this.在我的 controller 之一中,我有这个。 Can some one help me to fix this.有人可以帮我解决这个问题。

 public class LoggerController extends CloudRestTemplate {
@Autowired
LoggersMvcEndpoint loggerAPI;

 @Override
public Object getFromInternalApi(final String param) {
    return StringUtils.isEmpty(param) ? loggerAPI.invoke() : loggerAPI.get(param);
}

@Override
public Object postToInternalApi(final String param, final Object request) {
    return loggerAPI.set(param, (Map<String, String>) request);
}

} }

As per Spring docs here根据此处的 Spring 文档

Endpoint infrastructure端点基础设施

Spring Boot 2 brings a brand new endpoint infrastructure that allows you to define one or several operations in a technology independent fashion with support for Spring MVC, Spring WebFlux and Jersey. Spring Boot 2 brings a brand new endpoint infrastructure that allows you to define one or several operations in a technology independent fashion with support for Spring MVC, Spring WebFlux and Jersey. Spring Boot 2 will have native support for Jersey and writing an adapter for another JAX-RS implementation should be easy as long as there is a way to programmatically register resources. Spring Boot 2 将对 Jersey 提供本机支持,只要有一种以编程方式注册资源的方法,为另一个 JAX-RS 实现编写适配器应该很容易。

The new @Endpoint annotation declares this type to be an endpoint with a mandatory, unique id.新的 @Endpoint 注解声明此类型为具有强制唯一 ID 的端点。 As we will see later, a bunch of properties will be automatically inferred from that.正如我们稍后将看到的,会自动从中推断出一堆属性。 No additional code is required to expose this endpoint at /applications/loggers or as a org.springframework.boot:type=Endpoint,name=Loggers JMX MBean.无需其他代码即可在 /applications/loggers 或作为 org.springframework.boot:type=Endpoint,name=Loggers JMX MBean 公开此端点。

Refer to documentation, it will help you further参考文档,它将帮助您进一步

and for your info LoggersMvcEndpoint was there until 2.0.0.M3 https://docs.spring.io/spring-boot/docs/2.0.0.M3/api/org/springframework/boot/actuate/endpoint/mvc/LoggersMvcEndpoint.html however there is no reference of deprecation in subsequent version's release notes of 2.0.0.M4并且为了您的信息LoggersMvcEndpoint直到2.0.0.M3 https://docs.spring.io/spring-boot/docs/2.0.0.M3/api/org/springframework/boot/actuate/endpoint/m .html但是在后续版本的2.0.0.M4发行说明中没有提及弃用

https://docs.spring.io/spring-boot/docs/2.0.0.M4/api/deprecated-list.html#class https://docs.spring.io/spring-boot/docs/2.0.0.M4/api/deprecated-list.html#class

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM