当前位置: 首页 > news >正文

青海做网站找谁wordpress gif缩略图

青海做网站找谁,wordpress gif缩略图,网站如何做注册类 cpa,wordpress图床首页无缩略图IOC 注解开发 版本了解 2.0版本时开始支持注解开发#xff08;2.0之前就是昨天学习的纯 xml 操作#xff09;2.5版本才完善3.0版本支持纯注解开发 1.注解xml配置Bean 1.1配置用户mapper 配置 mapper public interface UserMapper {void save(); }配置 mapper 实现类…IOC 注解开发 版本了解 2.0版本时开始支持注解开发2.0之前就是昨天学习的纯 xml 操作2.5版本才完善3.0版本支持纯注解开发 1.注解xml配置Bean 1.1配置用户mapper 配置 mapper public interface UserMapper {void save(); }配置 mapper 实现类(还没有交给 spring 管理) public class UserMapperImpl implements UserMapper {public void save() {System.out.println(保存用户成功);} }1.2将mapper交给spring管理 使用 Component 注解 配置 mapper 实现类 Component public class UserMapperImpl implements UserMapper {public void save() {System.out.println(保存用户成功);} }配置 xml 包扫描路径 context:component-scan base-packagecn.sycoder.xmlAnnotationBean.mapper/?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:contexthttp://www.springframework.org/schema/contextxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsdcontext:component-scan base-packagecn.sycoder.xmlAnnotationBean.mapper/ /beans1.3通过容器获取bean 获取 applicationContext ApplicationContext context new ClassPathXmlApplicationContext(xmlAndAnnotation.xml);获取bean Test public void testComponent(){ApplicationContext context new ClassPathXmlApplicationContext(xmlAndAnnotation.xml);final UserMapper bean context.getBean(UserMapper.class);bean.save(); }1.4Component详解 默认不传参bean 的名称是首字母小写其余不变 正规命名的时候UserMapperImpl --- userMapperImpl 不正规命名时候UUserMapperImpl--- UUserMapperImpl给bean 指定名称 Component(u) 参数就是你bean的名称使用位置具体类的上方不要使用到接口上 作用将bean 交给spring管理 延伸的注解注意和Component一模一样的只不过是用于给程序员区分业务组件的 Controller 用于控制层 Controller public class UserController {//写接口 }Service 用于业务层 Service public class UserServiceImpl implements IUserService {public void save() {} }Repository 用于持久层 Repository public class UserMapperImpl implements UserMapper {public void save() {System.out.println(保存用户成功);} }2.纯注解配置Bean 2.1配置学生Mapper mapper 接口 public interface StudentMapper {void save(); }mapper 接口实现类 Repository public class StudentMapperImpl implements StudentMapper {public void save() {System.out.println(保存学生成功);} }2.2添加配置类 2.2.1Configuration详解 使用 Configuration Configuration public class SpringConfig { }将 SpringConfig 类变成spring 的配置类替换 xml 配置文件 作用标识该类是spring的配置类 配置名称默认首字母小写 使用在类上 2.2.2ComponentScan详解 配置包扫描 ComponentScan Configuration ComponentScan(cn.sycoder.annotationBean.mapper) public class SpringConfig { }作用配置包扫描路径,当前包及其子包都会扫描 value:指定包的路径用于扫描并且注册bean 2.3获取bean 获取 applicationContext ApplicationContext context new AnnotationConfigApplicationContext(SpringConfig.class);获取 bean Testpublic void testAnnotation(){ApplicationContext context new AnnotationConfigApplicationContext(SpringConfig.class);System.out.println(context);final StudentMapper bean context.getBean(StudentMapper.class);System.out.println(bean);}3.注解开发与xml 的梳理 使用Component 替代 xml 的过程梳理 使用 Configuration ComponentScan 与 xml 配置过程的梳理 4.bean scops 配置类 Configuration ComponentScan({cn.sycoder.scopes}) public class ScopesConfig { }配置 bean Component public class ScopeBean { }获取 bean 执行发现bean 单例的 Testpublic void testScope(){ApplicationContext context new AnnotationConfigApplicationContext(ScopesConfig.class);final ScopeBean bean context.getBean(ScopeBean.class);final ScopeBean bean1 context.getBean(ScopeBean.class);System.out.println(bean);System.out.println(bean1);}4.1通过注解修改 scope Scope Component Scope(prototype) public class ScopeBean { }4.2Scope 详解 位置定义到类上方作用修改对象创建的作用域属性默认是singleton单例的可以修改成 prototype(原型) 5.bean 生命周期常用注解 建立 bean 与使用 Component public class LifeBean {public LifeBean(){System.out.println(构造器执行了);}PostConstructpublic void init(){System.out.println(初始化bean);}PreDestroypublic void destroy(){System.out.println(销毁bean);} }5.1PostConstruct详解 位置方法上作用设置该方法为初始化方法 5.2PreDestroy 位置方法上作用设置该方法为销毁方法 5.3注解与 xml 的梳理
http://www.zqtcl.cn/news/196674/

相关文章:

  • 优秀网站设计赏析万网网站备案多久
  • 网站维护服务有哪些电商网站
  • 部门网站建设总结鼎城网站建设
  • 制作网站的模板下载大型商城购物平台开发
  • wordpress 分类文章置顶整站优化推广品牌
  • 网站手机验证码如何做官方网站在家做兼职
  • 东莞三合一网站制作网站建设 千助
  • 114网站做推广怎么样江苏建设培训网站
  • 如何让网站做网页适配网站上的产品五星怎样做优化
  • 怎么做网站排名优化免费jq网站模板
  • 源码时代培训机构官网自己建网站怎么做seo
  • 宜都网站制作济南比较大的网站制作公司
  • 怎么用电脑做网站主机假网站怎么制作
  • 网站 微信网络营销方案设计心得
  • 淘宝客 wordpress网站wordpress类似的工具
  • 农村建设房子建设网站建设渭南房产网站制作
  • php网站开发用什么win2008 iis 新建网站
  • 中山营销网站建设杭州网站建设开发有限公司
  • 被他人备案后做违法网站抖音seo推广
  • 手机网站广告代码南靖县建设局网站
  • 郑州网站建设智巢高德地图有外资背景吗
  • 网站开发常遇到客户问题wordpress怎么升级
  • 网站的空间是网站 建设 维护 公司
  • 关于网站建设的书籍网站设计的趋势
  • 临漳+网站建设深圳国贸网站建设
  • 安全的南昌网站制作上海网站建设网
  • 360网站制作潍坊医疗网站建设方案
  • 深圳网站策划公司域名解析暂时失败
  • 怎么做安居客网站wordpress 函数文件
  • 微名片网站怎么做html代码表示