写在最后
学习技术是一条慢长而艰苦的道路,不能靠一时激情,也不是熬几天几夜就能学好的,必须养成平时努力学习的习惯。所以:贵在坚持!
最后再分享的一些BATJ等大厂20、21年的面试题,把这些技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节,由于篇幅有限,上面只是以图片的形式给大家展示一部分。
Mybatis面试专题
MySQL面试专题
并发编程面试专题
org.springframework.cloud
spring-cloud-starter-netflix-eureka-server
2.2.5.RELEASE
org.springframework.boot
spring-boot-devtools
2.3.3.RELEASE
3、创建application.yaml配置文件
server:
port: 7001
#Eureka配置
eureka:
instance:
hostname: localhost #Eureka服务端的实例名称
client:
register-with-eureka: false #表示是否向Eureka注册中心注册自己
fetch-registry: false #如果为false,则表示自己为注册中心
service-url: #监控页面
#eureka.instance.hostname对应上面的localhost, server.port 7001
#http://localhost:7001/eureka/
#eureka server服务注册中心地址 暴露服务地址
defaultZone: http:// e u r e k a . i n s t a n c e . h o s t n a m e : {eureka.instance.hostname}: eureka.instance.hostname:{server.port}/eureka/ #指定服务名称 唯一标识
4、编写主启动类
package com.study.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer //开启Eureka服务,可以接收别人注册进来
public class EurekaServer_7001 {
//加群1025684353一起吹水聊天
public static void main(String[] args) {
SpringApplication.run(EurekaServer_7001.class,args);
}
}
启动测试
5、在需要注册的模块添加eureka客户依赖(springcloud-provider-dept-8001)
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
2.2.5.RELEASE
6、在yaml配置文件中添加Eureka配置
#Eureka配置,服务注册到哪里
eureka:
client:
service-url:
defaultZone: http://localhost:7001/eureka/ #指定服务注册中心地址
instance:
instance-id: springcloud-provider-dept8001 #修改Eureka默认描述信息
7、在主启动类中添加@EnableEurekaClient注解,标注这个模块是Eureka客户
8、启动测试,查看是否注册成功
-
1)先启动springcloud-eureka-7001,eureka服务
-
2)再启动springloud-provider-dept-8001,eureka客户
-
3)然后访问 localhost:7001 进入到eureka页面
- 4)出现红字是出发eureka自我保护机制
某时刻某一个微服务不可用,eureka不会立即清理,依旧会对该微服务的信息进行保存!
server:
#超时3S自动清除 60*1000 = 1分钟
eviction-interval-timer-in-ms: 3000
#关闭自我保护
enable-self-preservation: false
=====================================================================
1、在eureka客户(springloud-provider-dept-8001)中添加actuator依赖
org.springframework.boot
spring-boot-starter-actuator
2、配置eureka客户yaml
#info配置
info:
app.name: zhangsan-springcloud
company.name: blog.study.com
3、启动eureka客户,继续访问eureka服务
显示信息
=================================================================================
1、在eureka客户模块(springcloud-provider-dept-8001)中添加监管信息依赖
org.springframework.boot
spring-boot-starter-actuator
2、编写yaml监管信息
#info配置
info:
app.name: zhangsan-springcloud
company.name: blog.study.com
面试题总结
其它面试题(springboot、mybatis、并发、java中高级面试总结等)
发、java中高级面试总结等)**
[外链图片转存中…(img-0k8JKlbp-1715508774150)]
[外链图片转存中…(img-5ewN2x8R-1715508774151)]
[外链图片转存中…(img-jrND2Rcf-1715508774151)]