网申然后去现场面试的(面试地点北京)
在北京开放大学进行面试,但是早上找地方的时候遇到点困难,因为看到是西直门校区,就直接在西直门地铁站下了,然后去最近的开放大学校区,结果去错了校区,所以大家一定要直接百度那个名字,然后去,不要想当然。
去了之后会分组,我们是三个人一组,然后会一个一个的进去面试还是挺快的,面试的问题一般都是结合项目问的基础问题,还可以。面试完之后还要去另一个地方现场笔试,相隔距离有点远,笔试的地方环境感觉不太好,一群人围着会议室桌子坐着,加上坐了一晚上的火车没吃早饭,感觉精神很难集中,所以笔试做的henbuhao
1.springboot启动原理:
SpringApplication.run
??SpringApplication的run方法的主要流程大体可以归纳如下:
??1、创建和配置环境
??根据初始化的配置创建environment的类型,包括配置要使用的PropertySource以及Profile。
??启动监听器的environmentPrepared方法,调用所有监听器来监听。
??如果SpringApplication的showBanner属性被设置为true,则打印banner。
??2、创建ApplicationContext
??根据用户是否明确设置了applicationContextClass类型以及初始化阶段的推断结果,决定该为当前SpringBoot应用创建什么类型的ApplicationContext并创建完成,然后根据条件决定是否添加ShutdownHook,决定是否使用自定义的BeanNameGenerator,决定是否使用自定义的ResourceLoader,当然,最重要的,将之前准备好的Environment设置给创建好的ApplicationContext使用。
??3、加载资源,就是在初始化过程中source包含的类
??4、context 重新刷新
??调用ApplicationContext的refresh()方法,完成IoC容器可用的最后一道工序。
??5、配置spring boot特有的单例bean 如commandline相关
??6、监听器实现所有finished操作
??遍历执行SpringApplicationRunListener的finished()方法。
??至此,Spring boot的启动过程就完成了。
2.springboot有哪些常用的starter:
spring-boot-starter
这是Spring Boot的核心启动器,包含了自动配置、日志和YAML。
2.spring-boot-starter-aop
支持面向方面的编程即AOP,包括spring-aop和AspectJ。
3.spring-boot-starter-data-jpa
支持JPA(Java Persistence API. ,包括spring-data-jpa、spring-orm、Hibernate。
4.spring-boot-starter-data-mongodb
支持MongoDB数据,包括spring-data-mongodb。
5.spring-boot-starter-data-rest
通过spring-data-rest-webmvc,支持通过REST暴露Spring Data数据仓库。
6.spring-boot-starter-jdbc
支持JDBC数据库。
7.spring-boot-starter-redis
支持Redis键值存储数据库,包括spring-redis。
8.spring-boot-starter-security
支持spring-security。
9.spring-boot-starter-test
支持常规的测试依赖,包括JUnit、Hamcrest、Mockito以及spring-test模块。
10.spring-boot-starter-thymeleaf
支持Thymeleaf模板引擎,包括与Spring的集成。
11.spring-boot-starter-web
支持全栈式Web开发,包括Tomcat和spring-webmvc。
12.spring-boot-starter-websocket
支持WebSocket开发。
13.spring-boot-starter-ws
支持Spring Web Services。
14.spring-boot-starter-log4j
支持Log4J日志框架。
15.spring-boot-starter-logging
引入了Spring Boot默认的日志框架Logback。
16.spring-boot-starter-tomcat
引入了Spring Boot默认的HTTP引擎Tomcat。
笔试题:
1.上楼梯有多少种方式(一次可以迈一步或者两步)
public static int func(int n){
if(n>0){
if(n==1){
return 1;
}
if(n==2){
return 2;
}
return func(n-1)+func(n-2);
}else {
return 0;
}
}
2.最长子序列和
public static void maxLongChild(){
int[] input = {-1,-4,-2,-6,-3};
System.out.println(maxChildSum(input));
}
public static int maxChildSum(int[] array){
int[] state = new int[array.length];
state[0] = array[0];
for(int i=1;i
}
int k = state[0];
for(int i=0;i
k = state[i];
}
}
return k;
}
还有一道笔试题是一个公式记不清了