02 2021 档案

摘要:<!--依赖--> <dependencies> <!--mysql--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.6</version> <sc 阅读全文
posted @ 2021-02-13 20:44 AirCL 阅读(118) 评论(0) 推荐(0)
摘要:<!--Jackson JSON乱码问题配置--> <mvc:annotation-driven> <mvc:message-converters register-defaults="true"> <bean class="org.springframework.http.converter.St 阅读全文
posted @ 2021-02-12 12:24 AirCL 阅读(234) 评论(0) 推荐(0)
摘要:<!-- 前端控制器(加载classpath:springmvc.xml 服务器启动创建servlet) --> <servlet> <servlet-name>dispatcherServlet</servlet-name> <servlet-class>org.springframework.w 阅读全文
posted @ 2021-02-12 11:53 AirCL 阅读(195) 评论(0) 推荐(0)
摘要:学习完了Mybatis和Spring,一定要将它们串联起来才能够发挥最大的作用,下面我们来看看如何将Spring和Mybatis整合起来 前期准备 首先导入我们需要的maven依赖 <dependencies> <dependency> <groupId>org.mybatis</groupId> 阅读全文
posted @ 2021-02-07 20:19 AirCL 阅读(118) 评论(0) 推荐(0)
摘要:Spring的两大核心内容便是IoC和AOP,IoC我们已经了解过了,下面我们来看看AOP在Spring中的作用:提供声明式事务,允许用户自定义切面。AOP的内容 横切关注点:跨越应用程序多个模块的方法或功能。即是,与我们业务逻辑无关的,但是我们需要关注的部分,就是横切关注点。如日志,安全,缓存,事 阅读全文
posted @ 2021-02-06 13:16 AirCL 阅读(104) 评论(0) 推荐(0)
摘要:动态代理模板 /** * Description : * 公用这个类,自动生成代理类 * * @author : AirCL * Date : 2021/2/4 * Time : 20:27 */ public class ProxyInvocationHandler implements Invo 阅读全文
posted @ 2021-02-04 20:35 AirCL 阅读(66) 评论(0) 推荐(0)
摘要:在Spring项目中,我们也可以不通过配置文件applicationContext.xml来配置,而可以使用@Configuration注解,可以让我们完全脱离配置文件的苦恼。 示例: 1.config包 @Configuration @ComponentScan("com.aircl.domain 阅读全文
posted @ 2021-02-04 18:31 AirCL 阅读(115) 评论(0) 推荐(0)
摘要:Spring 4.x之后,如果需要使用注解进行开发,需要先导入aop包 然后加入context约束 接着打开注解和注解扫描(domain为博主的实体类包名) <!--开启注解--> <context:annotation-config/> <!--开启注解扫描包,将会自动扫描这个包下的注解--> < 阅读全文
posted @ 2021-02-04 17:15 AirCL 阅读(90) 评论(0) 推荐(0)
摘要:在Spring中有三种装配bean的方式: 1.在xml中显示的配置 这是我们之前一直在使用的方法 <bean id="helloBean" class="com.aircl.domain.Hello"> <property name="str" value="Hello Spring"></pro 阅读全文
posted @ 2021-02-04 14:54 AirCL 阅读(91) 评论(0) 推荐(0)
摘要:Spring官方给出的bean作用域如下 1. 单例模式 单例模式是Spring的默认机制,每次从容器中get的时候,都会创建一样的对象 <bean id="helloBean" class="com.aircl.domain.Hello" scope="singleton"> <property 阅读全文
posted @ 2021-02-04 13:12 AirCL 阅读(75) 评论(0) 推荐(0)
摘要:1.构造器注入 构造器方式注入在之前的学习笔记中已经记录:https://www.cnblogs.com/AirCL/p/14350568.html 2.Set方式注入 依赖注入:Set注入 依赖: bean对象的创建依赖于容器 注入:bean对象中的所有属性,由容器来注入 环境搭建:假设我们有实体 阅读全文
posted @ 2021-02-01 21:55 AirCL 阅读(124) 评论(0) 推荐(0)
摘要:问题 idea如何添加方法与方法之间的分割横线? 解决 打开setting,如下 效果 阅读全文
posted @ 2021-02-01 12:17 AirCL 阅读(849) 评论(0) 推荐(0)
摘要:Spring核心配置文件applicationContext.xml中,可配置如下内容 1.Alias Alias标签提供我们为注册过的bean增加别名的功能,我们已经在容器中注册过的bean,可通过alias标签,为其添加一个别名,使用时两个名称都可正常使用 <bean id="userBean" 阅读全文
posted @ 2021-02-01 11:23 AirCL 阅读(139) 评论(0) 推荐(0)