算法正义_正义联盟的Sprint Boot

算法正义

正义联盟(Justice League)进入了黑暗时代,强大的Darkseid征服了人类。 蝙蝠侠在《神力女超人》的帮助下,努力使联盟与一个关键方面失联。 适当的正义联盟成员管理系统。 由于时间不在他们身边,他们不想经历繁琐的过程,从头开始用他们需要的所有东西来建立项目。 蝙蝠侠将艰巨的任务交给了他心爱的值得信任的阿尔弗雷德·阿尔弗雷德(由于罗宾是如此不可预测),他告诉蝙蝠侠他回忆起遇到了一个叫做Spring Boot的东西,它可以帮助您设置所需的一切,以便您可以编写代码您的应用程序,而不会因设置项目配置的细微差别而陷入困境。 于是他进入了。 让我们与心爱的阿尔弗雷德(Alfred)谈谈,他将立即利用Spring Boot建立正义联盟成员管理系统。 自从蝙蝠侠喜欢直接使用REST API以来,至少现在是后端部分。

有许多方便的方法来设置Spring Boot应用程序。 在本文中,我们将重点介绍下载软件包(Spring CLI)并在Ubuntu上从头开始进行设置的传统方式。 Spring还支持通过其工具在线打包项目。 您可以从此处下载最新的稳定版本。 对于本文,我使用的是1.3.0.M1版本。

解压缩下载的存档后,首先,在配置文件中设置以下参数;

SPRING_BOOT_HOME=<extracted path>/spring-1.3.0.M1PATH=$SPRING_BOOT_HOME/bin:$PATH

然后在您的“ bashrc”文件中包括以下内容;

. <extracted-path>/spring-1.3.0.M1/shell-completion/bash/spring

最后执行的操作是,当您处理spring-cli以创建自己的spring boot应用程序时,它将使您在命令行上自动完成。 请记住同时“提供”配置文件和“ bashrc”文件,以使更改生效。

本文使用的技术栈如下:

  • SpringREST
  • Spring数据
  • MongoDB

因此,让我们通过发出以下命令开始为应用程序创建模板项目。 请注意,可以从找到的GitHub存储库中下载示例项目
在这里 ;

spring init -dweb,data-mongodb,flapdoodle-mongo  --groupId com.justiceleague --artifactId justiceleaguemodule --build maven justiceleaguesystem

这将使用Spring MVC和Spring Data以及嵌入式MongoDB生成一个maven项目。

默认情况下,spring-cli创建一个名称设置为“ Demo”的项目。 因此,我们将需要重命名生成的各个应用程序类。 如果您从上述我的GitHub存储库中签出了源代码,那么将完成此操作。

使用Spring boot,运行该应用程序就像运行该项目创建的jar文件一样简单,该jar文件实际上会调用该应用程序
用@SpringBootApplication注释的类可引导Spring。 让我们看看它是什么样子;

package com.justiceleague.justiceleaguemodule;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;/*** The main spring boot application which will start up a web container and wire* up all the required beans.* * @author dinuka**/
@SpringBootApplication
public class JusticeLeagueManagementApplication {public static void main(String[] args) {SpringApplication.run(JusticeLeagueManagementApplication.class, args);}
}

然后,我们进入域类,在其中使用spring-data和mongodb来定义我们的数据层。 域类如下;

package com.justiceleague.justiceleaguemodule.domain;import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;/*** This class holds the details that will be stored about the justice league* members on MongoDB.* * @author dinuka**/
@Document(collection = "justiceLeagueMembers")
public class JusticeLeagueMemberDetail {@Idprivate ObjectId id;@Indexedprivate String name;private String superPower;private String location;public JusticeLeagueMemberDetail(String name, String superPower, String location) {this.name = name;this.superPower = superPower;this.location = location;}public String getId() {return id.toString();}public void setId(String id) {this.id = new ObjectId(id);}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getSuperPower() {return superPower;}public void setSuperPower(String superPower) {this.superPower = superPower;}public String getLocation() {return location;}public void setLocation(String location) {this.location = location;}}

当我们使用spring数据时,它非常直观,特别是如果您来自JPA / Hibernate背景。 注释非常相似。 唯一的新东西是@Document批注,它表示我们mongo数据库中集合的名称。 我们还会在超级英雄的名称上定义一个索引,因为更多查询将围绕按名称搜索。

Spring-data附带了轻松定义存储库的功能,这些存储库支持通常的CRUD操作和一些读取操作,而无需直接编写即可。 因此,我们在应用程序中也利用了Spring数据存储库的功能,存储库类如下:

package com.justiceleague.justiceleaguemodule.dao;import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;import com.justiceleague.justiceleaguemodule.domain.JusticeLeagueMemberDetail;public interface JusticeLeagueRepository extends MongoRepository<JusticeLeagueMemberDetail, String> {/*** This method will retrieve the justice league member details pertaining to* the name passed in.* * @param superHeroName*            the name of the justice league member to search and retrieve.* @return an instance of {@link JusticeLeagueMemberDetail} with the member*         details.*/@Query("{ 'name' : {$regex: ?0, $options: 'i' }}")JusticeLeagueMemberDetail findBySuperHeroName(final String superHeroName);
}

常规的保存操作由Spring在运行时通过使用代理实现,我们只需要在存储库中定义域类即可。

如您所见,我们仅定义了一种方法。 借助@Query批注,我们试图与正则表达式用户一起寻找超级英雄。 选项“ i”表示尝试在mongo db中查找匹配项时,我们应忽略大小写。

接下来,我们继续执行我们的逻辑以通过我们的服务层存储新的正义联盟成员。

package com.justiceleague.justiceleaguemodule.service.impl;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import com.justiceleague.justiceleaguemodule.constants.MessageConstants.ErrorMessages;
import com.justiceleague.justiceleaguemodule.dao.JusticeLeagueRepository;
import com.justiceleague.justiceleaguemodule.domain.JusticeLeagueMemberDetail;
import com.justiceleague.justiceleaguemodule.exception.JusticeLeagueManagementException;
import com.justiceleague.justiceleaguemodule.service.JusticeLeagueMemberService;
import com.justiceleague.justiceleaguemodule.web.dto.JusticeLeagueMemberDTO;
import com.justiceleague.justiceleaguemodule.web.transformer.DTOToDomainTransformer;/*** This service class implements the {@link JusticeLeagueMemberService} to* provide the functionality required for the justice league system.* * @author dinuka**/
@Service
public class JusticeLeagueMemberServiceImpl implements JusticeLeagueMemberService {@Autowiredprivate JusticeLeagueRepository justiceLeagueRepo;/*** {@inheritDoc}*/public void addMember(JusticeLeagueMemberDTO justiceLeagueMember) {JusticeLeagueMemberDetail dbMember = justiceLeagueRepo.findBySuperHeroName(justiceLeagueMember.getName());if (dbMember != null) {throw new JusticeLeagueManagementException(ErrorMessages.MEMBER_ALREDY_EXISTS);}JusticeLeagueMemberDetail memberToPersist = DTOToDomainTransformer.transform(justiceLeagueMember);justiceLeagueRepo.insert(memberToPersist);}}

再说一遍,如果成员已经存在,我们抛出一个错误,否则我们添加该成员。 在这里您可以看到我们正在使用已经实施的
我们之前定义的spring数据存储库的insert方法。

最终,Alfred准备好使用Spring REST展示刚刚通过REST API开发的新功能,以便Batman可以随时随地通过HTTP发送详细信息。

package com.justiceleague.justiceleaguemodule.web.rest.controller;import javax.validation.Valid;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;import com.justiceleague.justiceleaguemodule.constants.MessageConstants;
import com.justiceleague.justiceleaguemodule.service.JusticeLeagueMemberService;
import com.justiceleague.justiceleaguemodule.web.dto.JusticeLeagueMemberDTO;
import com.justiceleague.justiceleaguemodule.web.dto.ResponseDTO;/*** This class exposes the REST API for the system.* * @author dinuka**/
@RestController
@RequestMapping("/justiceleague")
public class JusticeLeagueManagementController {@Autowiredprivate JusticeLeagueMemberService memberService;/*** This method will be used to add justice league members to the system.* * @param justiceLeagueMember*            the justice league member to add.* @return an instance of {@link ResponseDTO} which will notify whether*         adding the member was successful.*/@ResponseBody@ResponseStatus(value = HttpStatus.CREATED)@RequestMapping(method = RequestMethod.POST, path = "/addMember", produces = {MediaType.APPLICATION_JSON_VALUE }, consumes = { MediaType.APPLICATION_JSON_VALUE })public ResponseDTO addJusticeLeagueMember(@Valid @RequestBody JusticeLeagueMemberDTO justiceLeagueMember) {ResponseDTO responseDTO = new ResponseDTO(ResponseDTO.Status.SUCCESS,MessageConstants.MEMBER_ADDED_SUCCESSFULLY);try {memberService.addMember(justiceLeagueMember);} catch (Exception e) {responseDTO.setStatus(ResponseDTO.Status.FAIL);responseDTO.setMessage(e.getMessage());}return responseDTO;}
}

我们将功能作为JSON负载公开,因为尽管Alfred有点老派并且有时更喜欢XML,但Batman却无法获得足够的功能。

老家伙Alfred仍然想测试一下他的功能,因为TDD只是他的风格。 因此,最后我们看一下Alfred编写的集成测试,以确保正义联盟管理系统的初始版本能够按预期工作。 请注意,尽管Alfred实际上涵盖了更多内容,但您可以在
GitHub存储库

package com.justiceleague.justiceleaguemodule.test.util;import java.io.IOException;
import java.net.UnknownHostException;import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;import com.fasterxml.jackson.databind.ObjectMapper;
import com.justiceleague.justiceleaguemodule.domain.JusticeLeagueMemberDetail;import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodStarter;
import de.flapdoodle.embed.mongo.config.IMongodConfig;
import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
import de.flapdoodle.embed.mongo.config.Net;
import de.flapdoodle.embed.mongo.distribution.Version;/*** This class will have functionality required when running integration tests so* that invidivual classes do not need to implement the same functionality.* * @author dinuka**/
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public abstract class BaseIntegrationTest {@Autowiredprotected MockMvc mockMvc;protected ObjectMapper mapper;private static MongodExecutable mongodExecutable;@Autowiredprotected MongoTemplate mongoTemplate;@Beforepublic void setUp() {mapper = new ObjectMapper();}@Afterpublic void after() {mongoTemplate.dropCollection(JusticeLeagueMemberDetail.class);}/*** Here we are setting up an embedded mongodb instance to run with our* integration tests.* * @throws UnknownHostException* @throws IOException*/@BeforeClasspublic static void beforeClass() throws UnknownHostException, IOException {MongodStarter starter = MongodStarter.getDefaultInstance();IMongodConfig mongoConfig = new MongodConfigBuilder().version(Version.Main.PRODUCTION).net(new Net(27017, false)).build();mongodExecutable = starter.prepare(mongoConfig);try {mongodExecutable.start();} catch (Exception e) {closeMongoExecutable();}}@AfterClasspublic static void afterClass() {closeMongoExecutable();}private static void closeMongoExecutable() {if (mongodExecutable != null) {mongodExecutable.stop();}}}
package com.justiceleague.justiceleaguemodule.web.rest.controller;import org.hamcrest.beans.SamePropertyValuesAs;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;import com.justiceleague.justiceleaguemodule.constants.MessageConstants;
import com.justiceleague.justiceleaguemodule.constants.MessageConstants.ErrorMessages;
import com.justiceleague.justiceleaguemodule.domain.JusticeLeagueMemberDetail;
import com.justiceleague.justiceleaguemodule.test.util.BaseIntegrationTest;
import com.justiceleague.justiceleaguemodule.web.dto.JusticeLeagueMemberDTO;
import com.justiceleague.justiceleaguemodule.web.dto.ResponseDTO;
import com.justiceleague.justiceleaguemodule.web.dto.ResponseDTO.Status;/*** This class will test out the REST controller layer implemented by* {@link JusticeLeagueManagementController}* * @author dinuka**/
public class JusticeLeagueManagementControllerTest extends BaseIntegrationTest {/*** This method will test if the justice league member is added successfully* when valid details are passed in.* * @throws Exception*/@Testpublic void testAddJusticeLeagueMember() throws Exception {JusticeLeagueMemberDTO flash = new JusticeLeagueMemberDTO("Barry Allen", "super speed", "Central City");String jsonContent = mapper.writeValueAsString(flash);String response = mockMvc.perform(MockMvcRequestBuilders.post("/justiceleague/addMember").accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON).content(jsonContent)).andExpect(MockMvcResultMatchers.status().isCreated()).andReturn().getResponse().getContentAsString();ResponseDTO expected = new ResponseDTO(Status.SUCCESS, MessageConstants.MEMBER_ADDED_SUCCESSFULLY);ResponseDTO receivedResponse = mapper.readValue(response, ResponseDTO.class);Assert.assertThat(receivedResponse, SamePropertyValuesAs.samePropertyValuesAs(expected));}/*** This method will test if an appropriate failure response is given when* the member being added already exists within the system.* * @throws Exception*/@Testpublic void testAddJusticeLeagueMemberWhenMemberAlreadyExists() throws Exception {JusticeLeagueMemberDetail flashDetail = new JusticeLeagueMemberDetail("Barry Allen", "super speed","Central City");mongoTemplate.save(flashDetail);JusticeLeagueMemberDTO flash = new JusticeLeagueMemberDTO("Barry Allen", "super speed", "Central City");String jsonContent = mapper.writeValueAsString(flash);String response = mockMvc.perform(MockMvcRequestBuilders.post("/justiceleague/addMember").accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON).content(jsonContent)).andExpect(MockMvcResultMatchers.status().isCreated()).andReturn().getResponse().getContentAsString();ResponseDTO expected = new ResponseDTO(Status.FAIL, ErrorMessages.MEMBER_ALREDY_EXISTS);ResponseDTO receivedResponse = mapper.readValue(response, ResponseDTO.class);Assert.assertThat(receivedResponse, SamePropertyValuesAs.samePropertyValuesAs(expected));}/*** This method will test if a valid client error is given if the data* required are not passed within the JSON request payload which in this* case is the super hero name.* * @throws Exception*/@Testpublic void testAddJusticeLeagueMemberWhenNameNotPassedIn() throws Exception {// The super hero name is passed in as null here to see whether the// validation error handling kicks in.JusticeLeagueMemberDTO flash = new JusticeLeagueMemberDTO(null, "super speed", "Central City");String jsonContent = mapper.writeValueAsString(flash);mockMvc.perform(MockMvcRequestBuilders.post("/justiceleague/addMember").accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON).content(jsonContent)).andExpect(MockMvcResultMatchers.status().is4xxClientError());}}

就是这样。 借助Spring Boot的强大功能,Alfred能够立即获得带有REST API的最低限度的正义联盟管理系统。 我们将在接下来的时间基于该应用程序构建,并查看Alfred如何提出将这个应用程序通过docker部署到由Kubernetes管理的Amazon AWS实例上。 激动人心的时代即将来临。

翻译自: https://www.javacodegeeks.com/2017/07/spring-boot-justice-league.html

算法正义

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/334708.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

indesign如何画弧线_彩铅画入门教程,如何给独角兽设计一款好发型

戳这里 → 查看“爱蜜干货文章目录”本次综合训练的目的1&#xff0e;挖掘你的绘画感和想象力&#xff0c;彩色鬃毛色彩大家可以自由发挥哦&#xff01;2.练习彩铅的长线条&#xff0c;现在练习的长条还是比较简单的&#xff0c;下次综合训练我们还会练习更加复杂的3.彩铅这种画…

微型计算机作为载体的部件是,大工11秋《计算机应用基础》辅导资料二

计算机应用基础辅导资料二主题&#xff1a;计算机基础知识的辅导资料学习时间&#xff1a;2011年10月10日&#xff0d;10月16日内容&#xff1a;这周我们主要学习课件&#xff0e;&#xff0e;第二章计算机的基础知识&#xff0c;本章的学习要求及需要掌握的重点内容如下&#…

Linux 命令之 whereis -- 显示命令及相关文件的路径

文章目录一、命令介绍二、选项参数三、参考示例&#xff08;一&#xff09;显示 ln 命令的程序和 man 手册页的位置&#xff08;二&#xff09;显示 tomcat 相关文件的路径一、命令介绍 whereis 命令用来定位指令的二进制程序、源代码文件和man手册页等相关文件的路径。 wher…

markdown如何设置图片大小_Gitee(码云)实现免费 Markdown 图床

“阅读本文大概需要 6 分钟前言Markdown是一种易于上手的轻量级标记语言&#xff0c;由于其目的在于注重文字内容而不是排版&#xff0c;目前很受大家欢迎&#xff0c;写完一篇文档可以直接复制到其他各大平台上&#xff0c;不用担心格式字体等混乱问题但是文章中如果引用了某个…

json-tree api_什么是JSON处理(JSON-P API)?

json-tree apiJava EE中的JSON-P简介 JSON处理1.0&#xff08; JSR 353 &#xff09;的Java API是一个低级&#xff0c;轻量级的JSON解析器和生成器&#xff0c;它提供了在属性和值级别上操作JSON数据的能力。 JSR 353提供了两种JSON处理模型&#xff1a; 对象模型和流模型。 …

适合利用计算机模拟的是,计算机模拟在数学建模中的应用

计算机模拟在数学建模中的应用计算机模拟是按时间来划分的&#xff0c;因为计算机模拟实质上是系统随时间变化而变化的动态写照&#xff0c;以下是小编搜集整理的一篇探究计算机模拟在数学建模应用的论文范文&#xff0c;供大家阅读参考。【摘要】本文主要阐述了如何利用计算机…

噪音声压和声功率的区别_南昌汽车隔音,深入了解汽车噪音的来源、危害以及解决方案...

汽车噪音带来的危害&#xff1a;汽车噪音对人体健康的影响是多方面的。噪音作用于人的中枢神经系统&#xff0c;使人们大脑皮层的兴奋与抑制平衡失调&#xff0c;导致条件反射异常&#xff0c;使脑血管张力遭到损害。这些生理上的变化&#xff0c;在早期能够恢复原状&#xff0…

Linux 命令之 which -- 查找并显示给定命令的绝对路径(查找命令的位置/查询命令的位置/搜索命令的位置/查看命令的位置)

文章目录一、命令介绍二、选项参数三、参考示例&#xff08;一&#xff09;查找 java 命令的位置一、命令介绍 which 命令的作用是在 PATH 变量指定的路径中&#xff0c;搜索某个系统命令的位置&#xff0c;并且返回第一个搜索结果。 运维人员在日常工作中经常使用 which 命令…

lua加密教程_我们相信加密! 教程

lua加密教程许多人认为加密是一个复杂的主题&#xff0c;这很难理解。 可以实现其某些方面&#xff0c;但是每个人都可以理解它在更高层次上的工作方式。 这就是我要处理的这篇文章。 用简单的术语解释它是如何工作的&#xff0c;然后使用一些代码。 是的&#xff0c;我们信任…

生产用计算机软件管理台账,计算机台账管理系统

计算机台账管理系统计算机台账管理系统是什么&#xff1f;什么是计算机台账管理系统&#xff1f;对于设备管理而言&#xff0c;设备台账是其重要的组成部分&#xff0c;计算机台账管理系统对设备的编号、适用规格、年限、使用部门等具体信息进行管理&#xff0c;方便设备资产的…

Linux 查看数据库MySQL安装文件和安装目录的命令

文章目录数据库 MySQL 相关目录说明/var/lib/mysql/usr/bin/usr/share/mysql/usr/lib/mysql/etc/my.cnf查看 MySQL 相关文件/目录的命令查看已安装的 MySQL 相关软件包名称查看某个软件包的所有安装文件查看 MySQL 相关的所有文件使用命令 find 查找含有 mysql 关键字的文件路径…

java关键字和标识符_Java数据类型和标识符

java关键字和标识符在本教程中&#xff0c;我们将了解Java中的数据类型和标识符。 Java语言具有丰富的数据类型实现。 数据类型指定大小和可以存储在标识符中的值的类型。 Java数据类型分为两类&#xff1a; 原始数据类型 非原始数据类型 原始类型 Java定义了八种原始数据…

fcpx怎么合成延时摄影_延时摄影合成终极后期教程

原来常见的延时摄影&#xff0c;一般都是软件生成或视频加速实现&#xff0c;这种方法简单快捷&#xff0c;但是后期处理空间小&#xff0c;画质差。现在追求高画质都会采用拍摄照片&#xff0c;后期合成&#xff0c;索尼等相机型号&#xff0c;自带有间隔拍摄功能&#xff0c;…

狂妄之人怎么用计算机弹,【B】 Undertale Sans战斗曲 MEGALOVANIA狂妄之人

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼66/ 98868955/ 98868944/ 98868933/ 98868966/ 98868955/ 98868944/ 98868933/ 98868966/ 98868955/ 98868944/ 98868933/ 98868966/ 98868955/ 98868944/ 98868933/ 9886898 88 8 866 888998689 8889-* ///-/* 99 9(快速按) */…

Mac OS 在远程主机(Linux 系统)上使用命令执行 sql 脚本文件(使用的是 MySQL 数据库)

文章目录使用命令 mysql 执行脚本文件连接远程主机后&#xff0c;直接使用命令 mysql进入 MySQL 的 bin 目录后&#xff0c;再执行 mysql 命令使用命令 source 执行脚本文件sql 脚本文件内容&#xff1a;use production; BEGIN; INSERT INTO td_dictionary (dict_group,dict_co…

计算机网络的拓扑模型,基于复杂网络模型的计算机网络拓扑结构研究

一篇基于复杂网络模型的计算机网络拓扑结构研究论文第卷期第年月计算机科学基于复杂网络模型的计算机网络拓扑结构研究杜彩凤中国石油大学摘,东营,要,随着计算机网络的快速发展网络结构日益复杂传统的随机网络模型已很难对其拓扑特性作出客观的描,.述因此复杂网络理论为计算机网…

交华为换机access配置_华为交换机VLAN内Proxy ARP配置示例

华为交换机VLAN内Proxy ARP配置示例1、组网需求图1 VLAN内Proxy ARP组网示例图如上图1所示&#xff0c;Switch的接口GE1/0/2和GE1/0/1属于同一个sub-VLAN2。该sub-VLAN属于super-VLAN3。要求&#xff1a;属于同一VLAN2的两台主机hostA和hostB之间二层隔离。hostA和hostB之间通过…

java中regex_Java 9中的新Regex功能

java中regex最近&#xff0c;我收到了Packt出版的Anubhava Srivastava提供的免费书籍“ Java 9 Regular Expressions” 。 这本书是一个很好的教程&#xff0c;它向想要学习正则表达式并从头开始的任何人介绍。 那些知道如何使用正则表达式的人可能仍然很有趣&#xff0c;以重申…

mvc @html.editorfor,在MVC中,@Html.EditorFor(m = ( )_CSharp_开发99编程知识库

1 。Html.EditorFor(m > m)顯示整個模型編輯器。Html.EditorFor(m > m.propertyName)顯示模型的特定屬性編輯器。2 。Html.EditorFor(m > m)等於 Html.EditorFor(t > t)或 Html.EditorFor(randomName > randomName). 名稱並不重要&#xff0c;只是參數的名稱。 …

如何将本地 Windows 电脑中的文件复制(上传)到远程的 Windows 服务器主机上

文章目录第一步&#xff1a;点击「远程桌面连接」第二步&#xff1a;输入远程主机 IP 和 port第三步&#xff1a;设置本地目录共享第四步&#xff1a;点击「连接」按钮&#xff0c;输入登录用户名和密码第五步&#xff1a;复制本地文件到远程主机上第一步&#xff1a;点击「远程…