摘要:
1. 加入Spring-test依赖 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>5.2.7.RELEASE</version> </depende 阅读全文
posted @ 2020-07-11 23:21
阿布都日
阅读(125)
评论(0)
推荐(0)
摘要:
properties配置 jdbc.driver=org.h2.Driver jdbc.url=jdbc:h2:file:~/.h2/h2 jdbc.username=root jdbc.password=123456 pom配置 <?xml version="1.0" encoding="UTF- 阅读全文
posted @ 2020-07-11 22:53
阿布都日
阅读(200)
评论(0)
推荐(0)
摘要:
<?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:sc 阅读全文
posted @ 2020-07-11 21:39
阿布都日
阅读(142)
评论(0)
推荐(0)
摘要:
<?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:sc 阅读全文
posted @ 2020-07-11 21:23
阿布都日
阅读(159)
评论(0)
推荐(0)
摘要:
driverClass=org.h2.Driver jdbcUrl=jdbc:h2:file:~/.h2/h2 user=root password=123456 阅读全文
posted @ 2020-07-11 20:38
阿布都日
阅读(2074)
评论(0)
推荐(0)
摘要:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 阅读全文
posted @ 2020-07-11 18:50
阿布都日
阅读(334)
评论(0)
推荐(0)
摘要:
用于创建对象==<bean> value属性指定值,默认值是当前类名-首字母小写 1. @Component2. @Controller:表现层3. @Service:业务层4. @Repository:持久层 用于注入数据==<property>1. @Autowired:类型匹配->名称匹配2. 阅读全文
posted @ 2020-07-11 18:46
阿布都日
阅读(137)
评论(0)
推荐(0)
摘要:
复杂类型: 1. 数组 2. List 3. Set 4. Map 5. Properties <!--array,list,map,props,set标签用于注入集合类型--> <bean id="accountService" class="com.example.service.impl.Ac 阅读全文
posted @ 2020-07-11 18:27
阿布都日
阅读(62)
评论(0)
推荐(0)
摘要:
<!--property标签用于初始化bean对象--> <!--name:set方法名定位--> <!--value:注入基本类型和string类型 ref:注入bean对象--> <bean id="accountService" class="com.example.service.impl. 阅读全文
posted @ 2020-07-11 18:07
阿布都日
阅读(328)
评论(0)
推荐(0)
摘要:
<!--constructor-arg标签用于初始化bean对象--> <!--type:类型定位 index:位置定位 name:形参名定位--> <!--value:注入基本类型和string类型 ref:注入bean对象--> <bean id="accountService" class=" 阅读全文
posted @ 2020-07-11 18:02
阿布都日
阅读(137)
评论(0)
推荐(0)
摘要:
依赖注入: 可注入数据: 1. 基本类型+String 2. Bean对象 3. 集合类型 注入方式: 1. 构造函数注入 2. set方法注入 3. 注解注入 阅读全文
posted @ 2020-07-11 17:54
阿布都日
阅读(98)
评论(0)
推荐(0)
摘要:
Bean的三种创建方式 <!--方式一:默认构造函数创建--> <bean id="accountService" class="com.example.service.impl.AccountServiceImpl"></bean> <!--方式二:使用普通工厂创建--> <bean id="in 阅读全文
posted @ 2020-07-11 17:30
阿布都日
阅读(316)
评论(0)
推荐(0)
摘要:
Resource resource = new ClassPathResource("bean.xml"); BeanFactory factory = new XmlBeanFactory(resource); 阅读全文
posted @ 2020-07-11 15:29
阿布都日
阅读(221)
评论(0)
推荐(0)
摘要:
ApplicationContext ac=ClassPathXmlApplicationContext("beans.xml"); 阅读全文
posted @ 2020-07-11 15:23
阿布都日
阅读(328)
评论(0)
推荐(0)
摘要:
ApplicationContext:创建对象采用立即加载的方式。 BeanFactory:创建对象采用延迟加载的方式。 阅读全文
posted @ 2020-07-11 15:22
阿布都日
阅读(133)
评论(0)
推荐(0)
摘要:
ClassPathXmlApplicationContext:它可以加载类路径下的配置文件,文件必须在类路径下。 FileSystemXmlApplicationContext:它可以加载磁盘任意路径下的配置文件,必须有访问权限。 AnnotationConfigApplicationContext 阅读全文
posted @ 2020-07-11 15:09
阿布都日
阅读(310)
评论(0)
推荐(0)
摘要:
package com.example.ui; import com.example.factory.BeanFactory; import com.example.service.IAccountService; import com.example.service.impl.AccountSer 阅读全文
posted @ 2020-07-11 15:05
阿布都日
阅读(483)
评论(0)
推荐(0)
摘要:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance 阅读全文
posted @ 2020-07-11 14:32
阿布都日
阅读(125)
评论(0)
推荐(0)
摘要:
官网:http://spring.io/ 下载地址:http://repo.springsource.org/libs-release-local/org/springframework/spring 阅读全文
posted @ 2020-07-11 14:02
阿布都日
阅读(191)
评论(0)
推荐(0)
摘要:
package com.example.ui; import com.example.factory.BeanFactory; import com.example.service.IAccountService; /** * 模拟一个表现层,用于调用业务层 */ public class Clie 阅读全文
posted @ 2020-07-11 13:55
阿布都日
阅读(191)
评论(0)
推荐(0)
摘要:
package com.example.ui; import com.example.factory.BeanFactory; import com.example.service.IAccountService; import com.example.service.impl.AccountSer 阅读全文
posted @ 2020-07-11 12:23
阿布都日
阅读(328)
评论(0)
推荐(0)
摘要:
package com.example.service.ui; import com.example.service.IAccountService; import com.example.service.impl.AccountServiceImpl; /** * 模拟一个表现层,用于调用业务层 阅读全文
posted @ 2020-07-11 00:36
阿布都日
阅读(182)
评论(0)
推荐(0)
摘要:
降低依赖-编译期不依赖,运行期才依赖 1. 编译器依赖 package com.example.jdbc; import java.sql.*; public class JdbcDemo { public static void main(String[] args) throws SQLExce 阅读全文
posted @ 2020-07-11 00:17
阿布都日
阅读(166)
评论(0)
推荐(0)

浙公网安备 33010602011771号