☞☞☞AI 智能聊天, 问答助手, AI 智能搜索, 多模态理解力帮你轻松跨越从0到1的创作门槛☜☜☜
{"type":"doc","content":[{"type":"heading","content":[{"text":"从java全栈到vue3实战:一次真实面试的深度复盘","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":1,"id":"9e398c61-baa4-4b50-9987-a101d2daeb23"}},{"type":"heading","content":[{"text":"面试官与应聘者的初次交流","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"9f680c32-ad75-4be5-8c74-3a0ae5fc3327"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":你好,很高兴见到你。我是负责技术面试的,今天我们会聊一些技术相关的问题,希望你能放松一点。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"ae68d94f-6a61-4823-8463-be3bb9dd88a1"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":您好,感谢您的时间,我准备好了。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"fb9f9bef-7535-4239-9f9b-ed7408f87ff5"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":那我们先从你的背景开始吧。能简单介绍一下你自己吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"29ab6e17-18f2-47d8-930f-0a2513634741"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":好的,我叫李明,今年28岁,本科毕业于浙江大学计算机科学专业,之后在一家互联网公司担任java全栈开发工程师,有5年的工作经验。主要负责前后端系统的开发与维护,同时参与过几个中大型项目的架构设计。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"7897554b-e41d-4a2c-9d5f-7b812801c755"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":听起来不错,那你平时工作内容主要是什么?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"236f85e7-ea32-4161-8f6e-f83054d72137"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":我的核心职责包括使用spring boot和vue3构建企业级应用,以及使用mybatis和redis优化系统性能。此外,我还参与了微服务架构的设计与落地,帮助团队提升系统的可扩展性和稳定性。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"79c456ce-b2d2-4216-a00f-af9848bf8fde"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":很好,听起来你对技术有扎实的基础。那你能说说你在项目中遇到的最大挑战是什么吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"4ba7a55d-2aff-4672-b45a-13cfcc57f076"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":最大的挑战是在一个电商项目中,由于订单并发量大,导致数据库锁竞争严重,影响了系统性能。我通过引入redis缓存和优化事务机制,最终将响应时间降低了40%。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"b9746e1c-8755-4ab3-a3c6-60860546debe"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常棒!这说明你不仅关注代码质量,还注重系统的整体性能。接下来,我想问一些关于java和前端框架的问题。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"c6a56f89-68ad-4c65-92f3-2fd8d71d91e5"}},{"type":"heading","content":[{"text":"java基础与spring boot","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"44f44a46-2715-4f50-8058-172dcc051059"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":首先,我们来聊聊java基础。你知道jvm的内存结构是怎样的吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"7070ef67-d505-4f7f-8022-5131c9dcb007"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":jvm的内存结构主要包括方法区、堆、栈、本地方法栈和程序计数器。其中,堆是存储对象实例的地方,而栈用于存储局部变量和方法调用信息。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"0c21073c-346c-497f-a387-f8500e231b39"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":很好,那你知道jvm垃圾回收机制吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"5a82dc4e-b2bc-430c-bde9-cfa941fbce4b"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":是的,jvm的垃圾回收机制主要分为标记-清除、标记-整理和复制算法。不同的垃圾收集器(如g1、cms)适用于不同的应用场景。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"642a8621-a459-4d4b-a3f2-0fa90b1c17ae"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好,看来你对jvm有一定的了解。那我们来看看spring boot的相关问题。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"2bfdb3df-08db-4e7d-b005-969df7131fad"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":好的。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"1c807b5c-7bd3-4874-ab90-db777e7b4f2c"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":spring boot是如何简化spring应用的配置的?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"d5ede4c1-bf69-467a-9e1c-351ae5e5dbc1"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":spring boot通过自动配置和起步依赖的方式,减少了大量的xml配置。它会根据类路径上的依赖自动配置bean,使得开发者可以快速搭建应用。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"1b867ff8-84fc-4461-b4b8-14aae1368f02"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常准确。那你能写一个简单的spring boot控制器示例吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"7854a262-20ce-4608-b39b-ec859b677c57"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":当然可以。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"425ad870-2752-4cb7-9ab8-7665aa391971"}},{"type":"codeblock","content":[{"text":"@restcontrollerpublic class hellocontroller { @getmapping(\"/hello\") public string sayhello() { return \"hello, world!\"; }}","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"java","theme":"atom-one-dark","id":"22f7cabe-ee48-40d1-a9f5-cf80083ca742","key":"","languagebyai":"java"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":很好,这个例子很清晰。那你知道spring boot的启动流程吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"54a692fa-2c67-41a6-9885-8b50d11ac7bc"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":spring boot的启动流程大致分为加载配置、创建applicationcontext、初始化bean等步骤。其中,spring boot会通过springapplication.run()方法启动应用。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"cebea2e5-cb3e-4513-93aa-180e13eedaff"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常棒!接下来我们看看前端部分。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"9790f609-57cf-4b6a-9d6a-28662479be0a"}},{"type":"heading","content":[{"text":"vue3与前端框架","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"48178a99-1720-4ea1-a258-6977bc4b3b4d"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":我们知道你熟悉vue3,那你能解释一下vue3中的composition api吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"411d59df-d9fb-4ace-af41-e0594f60db26"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":composition api是vue3引入的新特性,允许开发者通过函数式编程的方式组织代码逻辑,而不是传统的options api。它提供了更灵活的代码复用方式。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"5b851e1f-05c7-441b-b0ef-f2a5596a05c6"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":很好。那你能写一个简单的vue3组件示例吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"e4b27d4c-aee5-4547-8f9f-b3d2c8eb0d29"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":当然可以。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"57eb3c09-4059-4b54-b3ad-4b864b66fc65"}},{"type":"codeblock","content":[{"text":"u003ctemplateu003e u003cdivu003e u003cpu003e{{ message }}u003c/pu003e u003cbutton @click=\"changemessage\"u003e改变消息u003c/buttonu003e u003c/divu003e\u003c/templateu003e\u003cscript setupu003eimport { ref } from 'vue';\const message = ref('hello, vue3!');\const changemessage = () =u003e { message.value = '消息已更改!';};\u003c/scriptu003e","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"javascript","theme":"atom-one-dark","id":"34a52e41-914f-4915-8660-eccb33e418d0","key":"","languagebyai":"javascript"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好,这个例子展示了vue3的响应式数据和事件绑定。那你知道vue3中的响应式系统是如何工作的吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"04dc2393-b382-4859-93bc-baf53cb2c472"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":vue3使用proxy对象来实现响应式,当数据发生变化时,视图会自动更新。这比vue2的object.defineproperty更加高效。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"49dcd41b-7b4e-4577-a250-ad52b964569e"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常准确。那你能说说vue3和vue2的主要区别吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"9e4193df-1550-42a5-a4cf-cd7a0ea165fb"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":vue3引入了composition api、更好的typescript支持、更快的运行速度,以及更小的包体积。这些改进使得vue3更适合大型项目。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"c34637b4-21ef-4126-b4ff-0b8fbaee283d"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常全面。接下来我们看看数据库和orm相关的知识。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"2c6e902b-9520-480b-8782-db5205a7bc7a"}},{"type":"heading","content":[{"text":"数据库与orm","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"7691da7f-599b-4c89-8575-8e0fc597bb27"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":你熟悉mybatis和jpa,那你能说说它们的区别吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"ded5def9-1296-48b4-8de4-508c889f10f9"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":mybatis是一个半自动的orm框架,需要手动编写sql语句,适合复杂的查询;而jpa是一个全自动的orm框架,基于注解,适合简单的crud操作。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"e6ad30e2-8aab-47ef-ba10-a91697064d0f"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":很好。那你能写一个mybatis的示例吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"31e59bd4-cda9-4097-be6d-e3b84814cf9b"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":当然可以。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"f5fd8ac2-ef3c-4835-8e3b-776b8710e53b"}},{"type":"codeblock","content":[{"text":"u003c!-- mybatis mapper xml --u003e\u003cselect id=\"selectuserbyid\" resulttype=\"com.example.user\"u003e select * from users where id = #{id}\u003c/selectu003e","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"xml","theme":"atom-one-dark","id":"2dfdd4ff-0069-43ec-aad8-1889cd342d31","key":"","languagebyai":"xml"}},{"type":"codeblock","content":[{"text":"// mybatis mapper interfacepublic interface usermapper { user selectuserbyid(int id);}","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"java","theme":"atom-one-dark","id":"a0d65816-aae0-4a25-90e7-1b6ec3c3e257","key":"","languagebyai":"java"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好,这个例子展示了mybatis的基本用法。那你知道jpa的实体类如何定义吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"2cce9dbd-d0d7-42fb-bcb9-bf768466bc50"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":jpa的实体类通常使用@entity注解,并且需要有一个主键字段,使用@id注解。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"c2fe2315-fbee-4ad1-bead-c0c32e723fc4"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常准确。那你能写一个jpa实体类的示例吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"f709547a-1f6e-4ee3-b91e-d2a9419f5f50"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":当然可以。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"e7730536-8b8a-4501-8fef-65611f021141"}},{"type":"codeblock","content":[{"text":"@entitypublic class user { @id @generatedvalue(strategy = generationtype.identity) private long id; private string name; private string email;\ // getters and setters}","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"java","theme":"atom-one-dark","id":"a9f239ac-958a-46b6-9ce8-8ac84065537d","key":"","languagebyai":"java"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好,这个例子展示了jpa的基本用法。接下来我们看看微服务和云原生相关的内容。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"f46840fc-7a6f-48f2-a5c2-23bd14e38abe"}},{"type":"heading","content":[{"text":"微服务与云原生","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"11b43172-972d-4cc7-ac03-0cb31f0236f4"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":你熟悉spring cloud,那你能说说spring cloud的核心组件吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"a369c595-8bec-43be-bf19-143eddb2f3bd"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":spring cloud包含eureka(服务发现)、feign(声明式rest客户端)、hystrix(熔断机制)、zuul(api网关)等组件。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"eda1a351-a452-4ba8-ad2d-8bb19b185c5a"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好。那你能说说什么是服务发现吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"90b4bba7-083e-492b-b30b-5417fc146fb2"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":服务发现是微服务架构中的一个重要概念,用于动态地发现和管理服务实例。eureka就是用来实现服务发现的。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"93582042-3b90-4eb5-8480-63c9ea5bdc3d"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常准确。那你能写一个eureka server的配置示例吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"100d6612-1f63-4284-ad94-5edb607f684d"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":当然可以。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"f09574ae-7c40-42a7-b0b9-619048771e86"}},{"type":"codeblock","content":[{"text":"server: port: 8761\spring: application: name: eureka-server\eureka: instance: hostname: localhost client: register-with-eureka: false fetch-registry: false service-url: defaultzone: http://localhost:8761/eureka/","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"yaml","theme":"atom-one-dark","id":"5b6a80df-ede8-49a6-9039-fb47d0ab0e9c","key":"","languagebyai":"yaml"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好,这个例子展示了eureka server的基本配置。那你知道spring cloud gateway的作用吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"b1714dec-a741-4d32-9a5f-6ab2dbcee356"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":spring cloud gateway是一个api网关,用于路由请求、过滤请求、鉴权等操作,是微服务架构中的重要组成部分。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"e3ec9bc5-d1b0-4690-96f8-81ea8bcc0344"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常全面。接下来我们看看测试框架。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"709b435c-42fd-4ab5-9276-1015a8c4b7a7"}},{"type":"heading","content":[{"text":"测试框架","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"328cacff-74f2-43ff-be52-b22c5ca7c1d0"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":你熟悉junit 5,那你能说说junit 5的主要特性吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"b5e4ec64-41bd-4187-a0ec-d005b8f09436"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":junit 5引入了新的api,支持参数化测试、嵌套测试、条件测试等功能,使得测试更加灵活和强大。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"5ecccf1a-142a-4d3b-89d3-736e15075efd"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好。那你能写一个junit 5的测试示例吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"ea81678d-f715-4ce7-a717-21750151ce9d"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":当然可以。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"5ebf59dc-f7b5-48a2-a952-e231acb16613"}},{"type":"codeblock","content":[{"text":"import org.junit.jupiter.api.*;\public class calculatortest { private calculator calculator;\ @beforeeach void setup() { calculator = new calculator(); }\ @test void testadd() { assertions.assertequals(5, calculator.add(2, 3)); }\ @test void testsubtract() { assertions.assertequals(1, calculator.subtract(3, 2)); }}","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"java","theme":"atom-one-dark","id":"5aaeba24-adba-4e91-8827-f2d1b5323d85","key":"","languagebyai":"java"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好,这个例子展示了junit 5的基本用法。那你知道mockito的作用吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"7e0f2fad-6fa4-4076-a063-442de52cdbc4"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":mockito是一个模拟框架,用于在单元测试中模拟对象的行为,避免依赖外部服务。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"8001bd5d-f656-4c77-a797-738c5e7194ac"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常准确。那你能写一个mockito的示例吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"5da5935d-6c3e-4d08-8a06-1ef2b4e788ad"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":当然可以。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"c49e10c8-766e-4b8d-bf71-fc99c21b9f01"}},{"type":"codeblock","content":[{"text":"import static org.mockito.mockito.*;import static org.junit.jupiter.api.assertions.*;\public class userservicetest { @test void testgetuser() { user user = mock(user.class); when(user.getname()).thenreturn(\"john\"); assertequals(\"john\", user.getname()); }}","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"java","theme":"atom-one-dark","id":"08dfce3f-d3f6-4568-b61f-7f8f44af3312","key":"","languagebyai":"java"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好,这个例子展示了mockito的基本用法。最后,我想问问你对未来的规划。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"d482833b-dbca-44dd-9e9c-5be887e558c7"}},{"type":"heading","content":[{"text":"未来规划与总结","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"f6d43a0d-a512-4d25-a0a9-9f967815f8fe"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":你对未来有什么规划吗?","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"4ce58bf3-7dae-418c-aa00-76bb6444c7c8"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":我希望能在技术上不断精进,尤其是在微服务和云原生方面。同时,我也希望能参与到更多的项目中,提升自己的架构设计能力。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"49fbf6a8-51bb-4b22-b901-39701b4ef7fa"}},{"type":"paragraph","content":[{"text":"面试官","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":非常好,听起来你对自己的职业发展有清晰的规划。今天的面试就到这里,感谢你的参与,我们会尽快通知你结果。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"ce34af53-6f00-4eda-a2eb-b63978c5cf25"}},{"type":"paragraph","content":[{"text":"应聘者","marks":[{"type":"textstyle","attrs":{"color":"","background":""}},{"type":"bold"}],"type":"text"},{"text":":谢谢您,期待您的回复。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"962f82a7-0fa8-4641-8fbd-753d2cc19a51"}},{"type":"heading","content":[{"text":"技术点总结","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"3d804dca-1497-490a-8b0e-8a3c5fd3a2d4"}},{"type":"paragraph","content":[{"text":"在这次面试中,我们讨论了多个技术点,包括java基础、spring boot、vue3、mybatis、jpa、spring cloud、junit 5和mockito等。通过这些技术点的深入探讨,我们可以看到应聘者对java全栈开发有着扎实的基础和丰富的实践经验。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"968ef769-215f-4865-99c8-630179373d94"}},{"type":"heading","content":[{"text":"代码示例回顾","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"9b93f542-61a2-42d0-b738-a119667e9fe8"}},{"type":"heading","content":[{"text":"spring boot 控制器示例","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":3,"id":"6706d863-ff5d-40e5-92eb-5d0f6d657a05"}},{"type":"codeblock","content":[{"text":"@restcontrollerpublic class hellocontroller { @getmapping(\"/hello\") public string sayhello() { return \"hello, world!\"; }}","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"java","theme":"atom-one-dark","id":"bc8ffa9b-e8ae-4986-9c76-1512141fde1a","key":"","languagebyai":"java"}},{"type":"heading","content":[{"text":"vue3 组件示例","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":3,"id":"9ce046b9-5e49-4aa6-bf10-e570dd4959c5"}},{"type":"codeblock","content":[{"text":"u003ctemplateu003e u003cdivu003e u003cpu003e{{ message }}u003c/pu003e u003cbutton @click=\"changemessage\"u003e改变消息u003c/buttonu003e u003c/divu003e\u003c/templateu003e\u003cscript setupu003eimport { ref } from 'vue';\const message = ref('hello, vue3!');\const changemessage = () =u003e { message.value = '消息已更改!';};\u003c/scriptu003e","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"javascript","theme":"atom-one-dark","id":"2df0958c-aca4-4b2a-b75d-d9dbc50026f2","key":"","languagebyai":"javascript"}},{"type":"heading","content":[{"text":"mybatis mapper xml 示例","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":3,"id":"474e4eec-7087-4ed2-a679-610ea71d23b9"}},{"type":"codeblock","content":[{"text":"u003cselect id=\"selectuserbyid\" resulttype=\"com.example.user\"u003e select * from users where id = #{id}\u003c/selectu003e","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"xml","theme":"atom-one-dark","id":"92ce3c82-9ab2-4489-a1ef-b317f63099b6","key":"","languagebyai":"xml"}},{"type":"heading","content":[{"text":"jpa 实体类示例","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":3,"id":"539749c2-133e-496d-b5c6-3859fea92201"}},{"type":"codeblock","content":[{"text":"@entitypublic class user { @id @generatedvalue(strategy = generationtype.identity) private long id; private string name; private string email;\ // getters and setters}","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"java","theme":"atom-one-dark","id":"36917bca-6ad4-4ded-b15b-9ab1d46be24c","key":"","languagebyai":"java"}},{"type":"heading","content":[{"text":"eureka server 配置示例","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":3,"id":"e71e9901-38c8-4316-85f9-60f94ccd2ff0"}},{"type":"codeblock","content":[{"text":"server: port: 8761\spring: application: name: eureka-server\eureka: instance: hostname: localhost client: register-with-eureka: false fetch-registry: false service-url: defaultzone: http://localhost:8761/eureka/","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"yaml","theme":"atom-one-dark","id":"891161ac-9beb-4a1d-b0af-8f3d6a07d520","key":"","languagebyai":"yaml"}},{"type":"heading","content":[{"text":"junit 5 测试示例","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":3,"id":"ba4ebdd7-f154-42e3-8e21-911d0e25cc7b"}},{"type":"codeblock","content":[{"text":"import org.junit.jupiter.api.*;\public class calculatortest { private calculator calculator;\ @beforeeach void setup() { calculator = new calculator(); }\ @test void testadd() { assertions.assertequals(5, calculator.add(2, 3)); }\ @test void testsubtract() { assertions.assertequals(1, calculator.subtract(3, 2)); }}","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"java","theme":"atom-one-dark","id":"edcb201e-4f6e-4888-a6b8-f1bc8f68caf1","key":"","languagebyai":"java"}},{"type":"heading","content":[{"text":"mockito 示例","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":3,"id":"eb576215-9c9f-4b16-81d8-81ae56424c15"}},{"type":"codeblock","content":[{"text":"import static org.mockito.mockito.*;import static org.junit.jupiter.api.assertions.*;\public class userservicetest { @test void testgetuser() { user user = mock(user.class); when(user.getname()).thenreturn(\"john\"); assertequals(\"john\", user.getname()); }}","type":"text"}],"attrs":{"ishoverdraghandle":false,"runtimes":0,"language":"java","theme":"atom-one-dark","id":"c0c0b291-a326-473b-b89d-151ccdf5dc76","key":"","languagebyai":"java"}},{"type":"heading","content":[{"text":"结束语","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"level":2,"id":"404d0e18-69c9-419e-bd59-869767c242fc"}},{"type":"paragraph","content":[{"text":"这次面试展示了一个java全栈开发者的全面技能,从后端到前端,再到数据库和微服务,都有深入的理解和实践经验。希望这篇文章能帮助读者更好地理解java全栈开发的技术要点,并在实际工作中加以应用。","type":"text"}],"attrs":{"ishoverdraghandle":false,"textalign":"inherit","indent":0,"id":"9575f02e-6ca1-4db4-b5a6-7415276bf026"}}]}