摘要: 一、使用组件扫描 在Spring入门代码案例中使用的是@Bean来进行注入的,但是这种注入需要编写代码,如果需要实例化后为属性赋值或则类似操作,那么使用@Bean注入就比较麻烦 这个时候我们这是用其他注解来注入对象 Spring提供了多种注解,来注入对象(格式相同,注解有多种的原因不是因为功能不同, 阅读全文
posted @ 2020-12-01 22:17 print("hello~world") 阅读(296) 评论(0) 推荐(0)
摘要: 一、什么是Junit单元测试 Javaunit 测试:替代我们编写main方法对我们编写的代码进行测试 二、为什么需要用到Junit单元测试 1.使用Junit测试可以一个类编写多个测试方法 2.测试类和程序类完全分离 3.Junit可以有更详细的测试报告 三、怎么使用Junit单元测试 1.在po 阅读全文
posted @ 2020-12-01 20:35 print("hello~world") 阅读(311) 评论(0) 推荐(0)
摘要: 1.创建maven项目 2.在pom.xml中添加spring相关依赖 <!-- Spring Context --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId 阅读全文
posted @ 2020-12-01 20:13 print("hello~world") 阅读(165) 评论(0) 推荐(0)
摘要: <!-- Spring Context --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>5.2.2.RELEASE</version> < 阅读全文
posted @ 2020-12-01 19:51 print("hello~world") 阅读(115) 评论(0) 推荐(0)
摘要: 警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException 阅读全文
posted @ 2020-12-01 15:45 print("hello~world") 阅读(320) 评论(0) 推荐(0)