上一页 1 2 3 4 5 6 7 8 9 10 ··· 21 下一页
摘要: ####属性的注入 @Component扫描到bean中,组件的意思,会用在实体类或者映射类上 @Autowired,将已经在bean中的类,引用 @Component //@Component 组件 //等价于<bean id="User" class="com.liu.pojo.User"/> 阅读全文
posted @ 2022-04-21 17:35 小幼虫虫 阅读(78) 评论(0) 推荐(0)
摘要: ###1导入约束 @Autowried用于属性类 导入约束:context约束 开启注解的支持 context:annotation-config/ <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframe 阅读全文
posted @ 2022-04-21 16:25 小幼虫虫 阅读(173) 评论(0) 推荐(0)
摘要: ###bean的自动装配 自动是Spring满足bean依赖的一种方式 Spring会在上下文中自动寻找,并自动给bean装配属性 在spring中有3中装配方式 在XML中显式的配置 在java中显式配置 在xml中隐式自动装配 ####在xml中隐式自动装配 <?xml version="1.0 阅读全文
posted @ 2022-04-21 15:24 小幼虫虫 阅读(36) 评论(0) 推荐(0)
摘要: ###bean的作用域 <bean id="User1" class="com.liu.pojo.User" p:age="18" p:name="小明" scope="singleton"></bean> 1、singleton作用域: Spring的scope的默认值是singleton Spr 阅读全文
posted @ 2022-04-21 14:50 小幼虫虫 阅读(67) 评论(0) 推荐(0)
摘要: ####文件头注入2行即可用 xmlns:p="http://www.springframework.org/schema/p" xmlns:c="http://www.springframework.org/schema/c" <?xml version="1.0" encoding="UTF-8 阅读全文
posted @ 2022-04-21 14:30 小幼虫虫 阅读(37) 评论(0) 推荐(0)
摘要: ###多种类型的注入方式 对象的属性 ####beans.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://w 阅读全文
posted @ 2022-04-20 18:38 小幼虫虫 阅读(63) 评论(0) 推荐(0)
摘要: 参考:https://blog.csdn.net/zxcbnm7089/article/details/105677523 ###别名 <alias name="User0" alias="001"></alias> ###导入 在团队开发中,在总的配置文件.xml导入其他同事的配置文件,就能起作用 阅读全文
posted @ 2022-04-20 17:29 小幼虫虫 阅读(99) 评论(0) 推荐(0)
摘要: ###Spring IOC创建对象 ####beans.xml 对象在配置文件的时候,就会实例化,并且每个实例只有1个 三种创建方式:建议使用第三种 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframe 阅读全文
posted @ 2022-04-20 17:11 小幼虫虫 阅读(32) 评论(0) 推荐(0)
摘要: ###IOC推导 之前的业务模式 1.UserDao接口 2.UserDaolmpl 实现类 3.UserService 业务接口 4.UserServicelmpl 业务实现类 在我们之前的业务中,用户的需求可能会影响我们原来的代码,我们需要根据用户的需求去修改原代码!如果程序代码量十分大,修改一 阅读全文
posted @ 2022-04-19 17:01 小幼虫虫 阅读(54) 评论(0) 推荐(0)
摘要: ##简介 Spring:春天 >给软件行业带来了春天! 2002,首次推出了Spring框架的雏形: interface21框架! Spring框架即以interface21框架为基础,经过重新设计,并不断丰富其内涵,于2004年3月24日,发布了1.0正式版。 Rod Johnson ,Sprin 阅读全文
posted @ 2022-04-19 15:01 小幼虫虫 阅读(82) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 21 下一页