最后
看完美团、字节、腾讯这三家的面试问题,是不是感觉问的特别多,可能咱们又得开启面试造火箭、工作拧螺丝的模式去准备下一次的面试了。
开篇有提及我可是足足背下了1000道题目,多少还是有点用的呢,我看了下,上面这些问题大部分都能从我背的题里找到的,所以今天给大家分享一下互联网工程师必备的面试1000题。
注意不论是我说的互联网面试1000题,还是后面提及的算法与数据结构、设计模式以及更多的Java学习笔记等,皆可分享给各位朋友
互联网工程师必备的面试1000题
而且从上面三家来看,算法与数据结构是必备不可少的呀,因此我建议大家可以去刷刷这本左程云大佬著作的《程序员代码面试指南 IT名企算法与数据结构题目最优解》,里面近200道真实出现过的经典代码面试题。
eureka-client-ribbon
Demo project for Spring Boot
org.springframework.boot
spring-boot-maven-plugin
org.springframework.boot
spring-boot-starter-web
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
org.springframework.cloud
spring-cloud-starter-netflix-ribbon
org.springframework.boot
spring-boot-starter-test
test
添加配置
server.port=8795
spring.application.name=eureka-client-ribbon
eureka.client.service-url.defaultZone=http://localhost:8791/eureka/
EurekaClientRibbonApplication 添加 @EnableEurekaClient 注解
@EnableEurekaClient
@SpringBootApplication
@ComponentScan(“com.springcloud.demo.eurekaclientribbon”)
public class EurekaClientRibbonApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaClientRibbonApplication.class, args);
}
}
这里要做负载均衡所以需要使用RestTemplate 和Ribbon 结合 ,创建RibbonConfig 类,注入RestTemplate,并添加@LoadBalanced注解,开启负载均衡功能。
@Configuration
public class RibbonConfig {
@Bean
@LoadBalanced
RestTemplate restTemplate(){
return new RestTemplate();
}
}
写一个 RibbonService 类调用eureka-client 中的main 服务
@Service
public class RibbonService {
@Autowired
RestTemplate restTemplate;
@HystrixCommand(fallbackMethod = “errorFallbackMsg”)
public int main(){
return restTemplate.getForObject(“http://eureka-client/main”,Integer.class);
总结
我们总是喜欢瞻仰大厂的大神们,但实际上大神也不过凡人,与菜鸟程序员相比,也就多花了几分心思,如果你再不努力,差距也只会越来越大。实际上,作为程序员,丰富自己的知识储备,提升自己的知识深度和广度是很有必要的。