ICode9

精准搜索请尝试: 精确搜索
  • spring-aop-事务-注解开发-代理2021-10-15 12:03:56

    1.spring + mybatis: Aop流程: 提前定义好几个用于Aop的类 前置通知:新建MyBeForeAdvice类 实现 MethodBeforeAdvice,并实现其方法 后置通知:新建MyAfterAdvice类 实现 AfterReturningAdvice,并实现其方法 环绕通知:新建RoundAdvice类 实现 MethodInterceptor ,并实现其方法 异常通知:新

  • Spring中IOC容器概念2021-10-12 14:06:53

    IOC容器概念 1、普通容器2、复杂容器3、IOC思想① 获取资源的传统方式②控制反转方式获取资源③DI 4、 IOC容器在Spring中的实现① BeanFactory②ApplicationContext③ApplicationContext的主要实现类 1、普通容器 ① 生活中的普通容器 例如杯子、水桶,用来存储,没有更多

  • Spring文档之容器概述2021-10-11 03:33:54

    目录2.2.1 配置元数据2.2.2 实例化一个容器编写基于 XML 的配置元数据2.2.3 使用容器 容器概述 The org.springframework.context.ApplicationContext interface represents the Spring IoC container and is responsible for instantiating, configuring, and assembling the bea

  • (II)第一节:IOC 和 DI2021-10-10 13:03:43

    一、IOC(Inversion(反转) Of Control):控制反转   控制:资源的获取方式:   (1)主动式:(每次要什么资源,就直接创建即可) BookServlet{ BookService bs = new BookService(); AirPlane ap = new AirPlane();//复杂对象的创建是比较庞大的工程; }     (2)被动式:资源的获取,不是我们

  • Error starting ApplicationContext. To display the conditions report re-run your application with ‘de2021-10-02 13:30:51

    项目场景:Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.问题的解决 问题描述: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enable

  • 启用 Spring-Cloud-OpenFeign 配置可刷新,项目无法启动,我 TM 人傻了(下)2021-10-02 09:00:21

    本篇文章涉及底层设计以及原理,以及问题定位,比较深入,篇幅较长,所以拆分成上下两篇: 上:问题简单描述以及 Spring Cloud RefreshScope 的原理 下:当前 spring-cloud-openfeign + spring-cloud-sleuth 带来的 bug 以及如何修复 Spring Cloud 中的配置动态刷新 其实在测试的程序中,我们

  • mybatis本地缓存&分布式缓存干货分享2021-09-30 13:02:34

    前言:干货记录学习mybatis实际开发中缓存的使用。 环境: springboot2.X + mybatis3.x Mybatis是一款持久层框架,它提供了一级缓存和二级缓存。 名词解释 一级缓存(mybatis默认开启) 同一个sqlSession中有效,在同一个SqlSession中,执行两次相同的sql查询,第二次不走数据库查询,而是

  • SpringContextHolder使用报SpringContextHolder使用报错:applicaitonContext属性未注入, 请在applicationContext.xml中定义Sp2021-09-30 12:34:18

       将 SpringContextHolder获取RedisUtil 实例改成,通过spring字段注入。使用@AutoConfigureAfter(RedisUtil.class)  AutoConfigureAfter:的作用是,让WorkflowListener的加载在 RedisUtil 之后。这样WorkflowListener加载的时候,RedisUtil 已经加载好了  

  • SpringWeb项目最基础配置入门2021-09-25 01:02:49

    1. 配置数据库配置文件jdbc.properties 2. 创建applicationContext.xml,spring-mvc.xml   2.1 配置applicationContext.xml:       ①加载数据库配置文件       ②配置数据源对象c3p0、druid、dbcp等等...       ③配置JDBCTemplate对象   2.2 配置spring-mvc

  • spring boot利用反射动态回调不同业务2021-09-23 16:03:17

            在实际的业务,开发中经常会出现在多个业务完成了同一个业务后需要回调到各自业务中来完成不同的操作,例如订单平台,在调佣统一的支付接口完成支付后,订单支付系统会将支付结果回调,这时,我们可能需要根据业务类型来回调到具体的service中 1:添加一个SpringBeanUtil的组

  • Spring入门教程笔记1 - bean的认识及使用2021-09-23 11:02:10

    Spring入门教程笔记1 - bean的认识及使用 简单介绍容器使用方法FileSystemXmlApplicationContextClassPathXmlApplicationContextWebXmlApplicationContext bean介绍代码示例Main方法bean注入方式结束语 简单介绍 Spring 是最受欢迎的企业级 Java EE开发框架,开发人员

  • Spring IOC_容器设计原理2021-09-20 13:05:26

    从顶层视图看:   本质上的工作原理就是:把应用程序的类和配置元数据组装起来,以便在ApplicationContext创建并初始化好之后,IoC容器直接为你提供了一个已经配置好并且可执行的系统或应用。 BeanFactory和ApplicationContext IOC容器接口设计图    其中的BeanFactory定义了基本的

  • Spring框架学习记录 6 集成 Junit 和 Web环境2021-09-18 21:33:12

    集成 Junit: 示例: (1)导入相关依赖 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.13.2</version> <scope>test</scope> </dependency> <dependency> &l

  • Spring框架:第三章:对象的生命周期及单例bean生命周期的11个步骤2021-09-17 10:03:41

    IOC之Bean的生命周期 实验22:创建带有生命周期方法的bean public class Person { private Integer id; private String name; public void init() { System.out.println("这是person对象的初始化方法"); } public void destroy() { System.out.println("这是person对

  • 记录springboot监听redis过期key2021-09-12 22:31:43

    在一个需求中,需要当redis的key删除或过期的时候往日志表中插入一条对应的记录。那么如何监听redis的过期key呢? 1.首先需要设置redis配置文件 notify-keyspace-events Ex, 或者使用命令 CONFIG set notify-keyspace-events Ex。 那么notify-keyspace-events 后面都有哪些参数呢

  • spring通过bean名称,方法名,反射调用服务。2021-09-12 08:00:57

    示例代码 import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.util.ReflectionUtils; import java.lang.reflect.Method;

  • Spring面试基础2021-09-11 20:33:30

    Spring面试总结 spring的核心是控制反转(IOC)和面向切面编程(AOP) spring简介 Spring是一个轻量级的ioc和aop容器框架。目的是为了解决企业级应用开发的业务逻辑层和其他各层的耦合问题以及应用开发的复杂性,简化java开发 优点: Spring属于低侵入设计,代码的污染极低 spring的DI机制

  • IoC配置(ApplicationContext对象层次结构)2021-09-11 10:58:20

    ApplicationContext 1.ApplicationContext是一个接口,提供了访问spring容器的API2.ClassPathXmlApplicationContext是一个类,实现了上述功能3.ApplicationContext的顶层接口是BeanFactory4.BeanFactory定义了bean相关的最基本操作5.ApplicationContext在BeanFactory基础上追加

  • applicationContext.xml和dispatcher-servlet.xml的区别2021-09-09 18:35:13

    spring官方文档介绍 Spring lets you define multiple contexts in a parent-child hierarchy. The applicationContext.xml defines the beans for the "root webapp context", i.e. the context associated with the webapp. The spring-servlet.xml (or whatever el

  • SpringIOC 面试题(下)2021-09-09 11:29:49

    上篇给大家讲了一下SpringIOC的启动流程,接下来给大家讲讲DI—Dependency Injection(依赖注入) 什么是依赖注入(DI) DI—Dependency Injection,即“依赖注入”:组件之间依赖关系由容器在运行期决定,形象的说,即由容器动态的将某个依赖关系注入到组件之中。依赖注入的目的并非为软件

  • 创建第一个Spring程序2021-09-08 20:02:37

    开发工具准备 开发工具:idea2017 以上 依赖管理:maven3 以上 jdk:1.8 以上 使用Maven创建Spring项目 选择Maven勾选Create from archetype选择maven-archetype-quickstart 填写项目信息 指定maven 创建成功 使用Java Enterprise创建Spring项目 默认即可 Version一般选择J

  • 获取spring context中bean,实现按需调用接口2021-09-03 15:01:34

    背景 调用方传入一个json,按json中的api字段值去调用本系统中不同类去完成不同的功能。为了统一和可扩展,通过context中的bean的方式去转发。 实现 1、定义一个接口 public interface Req { public String process(String request); } 2、所有实现类都implement该接口 @Compon

  • Android WorkManager 定时任务2021-08-30 13:04:17

    App有时可能需要定期运行某些工作。例如,可能要定期备份数据、上传信息到服务器,定期获取新的内容等等。 在app运行期间,我们使用Handler也可以完成定期的功能。在这里我们介绍WorkManager使用定时任务的方法。 前面我们介绍了WorkManager的使用方法,约束和延迟等。本文介绍WorkManage

  • 六种方式,教你在SpringBoot初始化时搞点事情!2021-08-29 18:35:46

    1、监听容器刷新完成扩展点ApplicationListener<ContextRefreshedEvent> ApplicationContext事件机制是观察者设计模式实现的,通过ApplicationEvent和ApplicationListener这两个接口实现ApplicationContext的事件机制。 Spring中一些内置的事件如下: ContextRefreshedEvent:Applicat

  • IOC概念和原理:BeanFactory 接口与ApplicationContext2021-08-24 18:34:18

    IOC(概念和原理)1、什么是 IOC(1)控制反转,把对象创建和对象之间的调用过程,交给 Spring 进行管理(2)使用 IOC 目的:为了耦合度降低(3)做入门案例就是 IOC 实现2、IOC 底层原理(1)xml 解析、工厂模式、反射3、画图讲解 IOC 底层原理     IOC(BeanFactory 接口)1、IOC 思想基于 IOC 容器完成,IO

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有