- 博客(9)
- 资源 (2)
- 收藏
- 关注
原创 Git常用场景使用-分支操作
1. 拉取推送分支: git branch 分支名 : 创建分支 git checkout 分支名 : 切换分支 git checkout –b 分支名 : 创建并切换到新分支 本地拉取分支
2020-09-29 22:33:38 551
原创 SpringBoot(3)-MVC自动配置及自定义视图控制器
0. 主要类:WebMvcAutoConfiguration: MVC的自动配置类EnableWebMvcConfiguration: 启用WebMvcConfiguration的类DelegatingWebMvcConfiguration: WebMvcConfiguration委托的代理类WebMvcConfigurerComposite: “具体WebMvcConfiguration的委托类”`WebMvcAutoConfigurationAdapter: MVC自动配置适配器,其实
2020-09-26 20:13:52 860
原创 SpringBoot(2)-MVC执行过程
0. 基本过程:文字流程:1). 用户发送请求至前端控制器DispatcherServlet2). DispatcherServlet收到请求调用处理器映射器HandlerMapping。3).处理器映射器根据请求url找到具体的处理器,生成处理器执行链HandlerExecutionChain(包括处理器对象和处理器拦截器)一并返回给DispatcherServlet。4). DispatcherServlet根据处理器Handler获取处理器适配器HandlerAdapter执行Handle
2020-09-26 20:13:03 468
原创 SpringMVC执行过程-HandlerMapping初始化&handlerMap初始化
基础环境: spring-boot :2.3.3.RELEASE、jdk1.80. 背景: 通过以下方式可以自定义视图,即访问/testView会跳转success.html页面 那么这样设置的原理是什么?本文就是探讨这个问题@Configurationpublic class MyConfigure implements WebMvcConfigurer { @Override public void addViewControllers(ViewControllerR.
2020-09-26 20:11:46 738
原创 SpringBoot(1)-容器组件自动配置
基础环境: spring-boot :2.3.3.RELEASE、jdk1.8@SpringBootApplication:主配置类注解 标注此注解的类就是SpringBoot的主配置类,启动该类来启动应用。 这是一个组合注解,主要关注@EnableAutoConfiguration自动配置@Target(ElementType.TYPE)@Retention(RetentionPolicy.RUNTIME)@Documented@Inherited@SpringBootConfi.
2020-09-21 21:29:42 532
原创 PowerMockito单元测试(4)-异常覆盖的方式
4. 异常覆盖的方式: 4-1. 触发异常方法的对象可以mock,在调用的时候触发异常,那么可以使用doThrow来操作//a.对异常打桩DataAccessException exception = PowerMockito.mock(DataAccessException.class);//b.模拟try内的方法,doThrow异常PowerMockito.doThrow(exception).when(userMappers).getUsers(“test”)//c.模拟catch内的方
2020-09-14 21:15:23 8788 3
原创 PowerMockito单元测试(3)-私有静态方法单元测试与stub方法
3. 私有静态方法单元测试: 【公共方法&私有方法】:public class UserUtil{ public static String generateUserToken(String userId){ if(StringUtils.isEmpty(userId)){ return StringUtils.EMPTY; } PublicKey key = getPublicKey(userId); if(key == null){ return Strin
2020-09-13 22:48:07 4474 3
原创 PowerMockito单元测试(2)-返回void的方法测试覆盖
2. 返回void的测试覆盖 【要测试的方法】:@Componentpublic class UserDao{ @Autowired private UserMapper userMapper @Autowired private SystemErrorRecoder systemErrorRecoder public void putUser(UserDTO userDto){ try{ userMapper.putUser(userDto); }catch(Dat
2020-09-13 20:47:48 10338 1
原创 PowerMockito单元测试(1)-主要思想以及常规异常覆盖
1. 测试主要操作步骤: 【要测试的方法】:@Componentpublic class UserDao{ @Autowired private UserMapper userMapper @Autowired private SystemErrorRecoder systemErrorRecoder
2020-09-12 22:55:03 2997
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人