当前位置: 首页 > 知识库问答 >
问题:

您将如何为Java注释此代码?

越运锋
2023-03-14

@Bean public WebMvcEndpoint HandlerMap webEndpoint ServletHandlerMap(WebEndpoint供应商webEndpoint供应商,ServletEndpoint供应商html" target="_blank">servletEndpoint供应商,控制器Endpoint供应商控制器Endpoint供应商,Endpoint MediaTypes endpoint MediaTypes, CorsEndpoint Properties corsProperties, WebEndpoint Properties webEndpoint Properties,环境环境){列表

private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, String basePath) { return webEndpointProperties.getDiscovery().isEnabled()

共有1个答案

冯育
2023-03-14

我不确定这是否是你所指的,但我认为一个正常的评论应该可以。

        /*@Bean public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier, ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier, EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties, WebEndpointProperties webEndpointProperties, Environment environment) { List<ExposableEndpoint<?>> allEndpoints = new ArrayList<>(); Collection webEndpoints = webEndpointsSupplier.getEndpoints(); allEndpoints.addAll(webEndpoints); allEndpoints.addAll(servletEndpointsSupplier.getEndpoints()); allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints()); String basePath = webEndpointProperties.getBasePath(); EndpointMapping endpointMapping = new EndpointMapping(basePath); boolean shouldRegisterLinksMapping = this.shouldRegisterLinksMapping(webEndpointProperties, environment, basePath); return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes, corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath), shouldRegisterLinksMapping, null); }

private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment, String basePath) { return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath) || ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT)); }*/

Java中的注释可以是单行或多行,使用以下命令:

//Single Line Comment!

/*
Multi
Line
Comment!
*/

我希望这有帮助!

 类似资料:
  • 问题内容: 是否可以注释代码块?例如循环还是大括号?如果是这样,怎么办? 第一.java ForCycle.java 根据http://www.javacodegeeks.com/2012/11/java-annotations-tutorial-with-custom- annotation.html @Target –指示注释类型适用的程序元素的种类。一些可能的值是TYPE,METHOD,CO

  • 问题内容: 我有一个项目,其布局如下: src / java包含jpa实体和使用由hibernate元模型注释处理器生成的jpa元模型类的查询类。 将注释处理并入Java插件的最佳方法是什么? 我目前已定义以下任务,但是它对compileJava具有任务依赖性,因为某些代码取决于注释处理器生成的类,所以该任务将失败。 问题答案: 之所以依赖,是因为您将测试编译类路径放在前一个任务的编译类路径上,并

  • 问题内容: 我正在阅读Angular JS文档。我无法弄清楚我在以下代码中提到的一行。谁能解释? script.js : index.html : 我不明白这一点: 在这里,为什么要使用两个s。 问题答案: Angular JS-内联数组注释 它用于避免缩小问题。缩小后,代码如下: 因此,Angular知道要注入哪些依赖项。 否则看起来像 最小化和角度之后,不知道哪个依赖是什么意思。 您可以在An

  • 问题内容: 我刚刚开始使用Java 8,并且正在使用以下代码片段: 如何将其转换为Lambda样式? 问题答案: 如果是 功能界面 ,则可以 这是您问题中其他类的存根实现的完整示例:

  • 我这么叫它: 我有什么方法可以重构我的方法,以便我可以像这样调用它(只有1λ):

  • 注释前 注释后 按下 vscode 的 ctrl+/ 注释 报错: 为什么?我该怎么办?