![](https://img-blog.csdnimg.cn/788ece8676f64c5e9f1973ff30f8876a.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Spring
Spring Framework
冰点契约丶
西安互联网付费就业,Java开发,软件测试开发线上线下辅导 欢迎有需要的朋友咨询。
展开
-
Spring底层原理(六)
Spring底层原理(六)原创 2023-11-03 18:01:22 · 147 阅读 · 0 评论 -
Spring底层原理(五)
介绍Aware接口与InitializingBean接口、Bean的初始化与销毁、Scope原创 2023-11-02 11:37:35 · 145 阅读 · 0 评论 -
Spring底层原理(四)
Spring底层原理(四)-BeanFactoryPostProcessor常见组件以及模拟实现原创 2023-11-01 17:46:36 · 186 阅读 · 0 评论 -
Spring底层原理(三)
Spring底层原理(三)原创 2023-10-25 14:09:31 · 223 阅读 · 0 评论 -
Spring底层原理(三)
Spring底层原理(三)原创 2023-10-24 18:05:27 · 329 阅读 · 1 评论 -
Spring底层原理(二)
Spring底层原理(二)原创 2023-10-23 18:56:58 · 182 阅读 · 0 评论 -
Spring底层原理(一)
Spring底层原理(一)原创 2023-10-23 17:00:17 · 189 阅读 · 0 评论 -
Spring-Context的作用
spring-context提供应用程序上下文,这是Spring的依赖注入容器,它可能总是在以某种方式使用Spring Framework的工件的POM中定义.实际上,spring-context依赖于spring-core,因此通过将spring-context定义为依赖项,您的类路径中也会包含spring-core....原创 2022-03-06 14:33:59 · 4503 阅读 · 0 评论 -
配置Spring事务
配置Spring事务<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="datasource"/></bean><tx:advice id="txAdvice" transaction-manager="transactionMana原创 2022-01-15 18:47:00 · 51 阅读 · 0 评论 -
整合Spring与MyBatis
整合spring与mybatis1.导入依赖<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://原创 2022-01-15 17:59:28 · 230 阅读 · 0 评论 -
通过注解的方式实现AOP
使用注解实现AOP1.创建切面类package com.web.aop;import org.aspectj.lang.annotation.After;import org.aspectj.lang.annotation.Aspect;import org.aspectj.lang.annotation.Before;import org.springframework.stereotype.Component;@Aspect@Componentpublic class Log {原创 2022-01-09 23:51:19 · 2201 阅读 · 0 评论 -
通过接口的方式实现AOP
通过实现接口的方式实现AOPSpring的通知类型BeforeAdvice:在连接点之前运行AfterReturningAdvice:在连接点完成后运行AfterThrowingAdvice:如果通过抛出一个异常退出,则运行通知 AfterAdvice:无论通过何种方式运行的连接点退出AroundAdvice:环绕连接点的通知,例如方法调用定义前置增强package com.web.log;import org.springframework.aop.MethodBeforeAdvic原创 2022-01-09 23:49:30 · 422 阅读 · 0 评论 -
Spring注解开发
Spring注解开发1.使用Spring注解开发的前提<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema原创 2022-01-09 11:35:37 · 48 阅读 · 0 评论 -
IOC自动注入
1.通过配置xml的方式来进行自动注入在bean的参数选项中通过指定autowire属性进行自动注入<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://ww原创 2022-01-08 19:59:18 · 226 阅读 · 0 评论 -
Bean的作用域
我们可以在ApplicationContext.xml中配置bean的同时指定bean的作用域(scope)singleton:默认,将单个 bean 定义范围限定为每个 Spring IoC 的单个对象实例容器prototype:将单个 bean 定义范围限定为任意数量的对象实例request:将单个 bean 定义范围限定为单个 HTTP 请求的生命周期。 那是, 每个 HTTP 请求都有自己的 bean 实例,该实例是在单个 bean 的背面创建的 定义, 仅在 web-aware Spring原创 2022-01-08 06:40:33 · 204 阅读 · 0 评论 -
c命名空间与p命名空间
c:construct 构造器注入p:property 属性注入c命名空间注入和p命名空间注入都属于第三方注入,需要引入xml依赖xmlns:p="http://www.springframework.org/schema/p"xmlns:c="http://www.springframework.org/schema/c"案例:1.创建pojo类package com.web.pojo;import lombok.AllArgsConstructor;import lombok.Da原创 2022-01-08 06:02:25 · 323 阅读 · 0 评论 -
Set注入
此处通过案例的方式讲解set注入,具体实现查看第二步1.创建pojo对象package com.web.pojo;import java.util.*;public class User { private Address address; private String username; private String[] books; private Set<String> hobbies; private Map<String,Str原创 2022-01-08 05:28:12 · 79 阅读 · 0 评论 -
SpringConfig
Spring配置<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://w原创 2022-01-06 02:37:00 · 312 阅读 · 0 评论 -
IOC创建对象的方式
创建pojopackage com.web.pojo;public class Blog { private String title; private int views; private String author; public Blog() { System.out.println("调用了Blog无参构造"); } public void setTitle(String title) { this.title原创 2022-01-05 01:01:36 · 60 阅读 · 0 评论 -
HelloSpring
创建pojo对象package com.web.pojo;public class User { private String username; private String password; public User() { } public User(String username, String password) { this.username = username; this.password = password原创 2022-01-04 23:11:07 · 76 阅读 · 0 评论 -
IOC推导
DAO层package com.web.dao;import com.web.pojo.User;public interface UserDao { User getUser();}package com.web.dao;import com.web.pojo.User;public class UserDaoImplByMySQL implements UserDao{ @Override public User getUser() { S原创 2022-01-04 06:14:07 · 225 阅读 · 0 评论 -
解决Jackson乱码问题
在spring配置文件中添加如下配置信息,解决objectMapper乱码问题<mvc:annotation-driven> <mvc:message-converters register-defaults="true"> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <constru原创 2021-12-12 23:45:58 · 814 阅读 · 0 评论 -
解决SpringMVC乱码问题
在web.xml中添加spring自带的encoding过滤器<filter> <filter-name>encodingFilter</filter-name> <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> <init-param> <param-name>enco原创 2021-12-12 23:40:07 · 72 阅读 · 0 评论 -
Spring-AOP
AOP(面向切面编程)什么是AOP?AOP(Aspect Oriented Programming)意为:面向切面编程,通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术。AOP是OOP的延续,是软件开发中的一个热点,也是Spring框架中的一个重要内容,是函数式编程的一种衍生范型。利用AOP可以对业务逻辑的各个部分进行隔离,从而使得业务逻辑各部分之间的耦合度降低,提高程序的可重用性,同时提高了开发的效率。AOP的实现一:使用SpringAPI实现导入依赖 <!-- htt原创 2021-12-05 22:26:30 · 419 阅读 · 0 评论 -
使用注解自动装配
自动装配@Autowired:先根据type进行匹配,再根据name进行匹配,可以删除对set get方法没有要求@Qualifier:结合@Autowired使用,可以指定自动注入的id名称@Resource:Java自带注解,先根据name进行匹配,再根据type进行匹配,可通过name属性指定注入的id名称通过注解的方式自动装配注意事项:1.需要在xml文件中添加:context:annotation-config/2.需要添加:xmlns:context=“http://www.spri原创 2021-12-02 17:07:01 · 255 阅读 · 0 评论