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

如何建设网站和app离我最近的广告公司在哪里

如何建设网站和app,离我最近的广告公司在哪里,做企业网站开发哪家好,温州网站建设的公司标题注入依赖注入的方式通过Set方法注入通过构造方法注入自动注入依赖注入的数据类型注入Bean对象注入基本数据类型和字符串注入List注入Set注入Map注入Properties注解实现IOCComponentRepository、Service、Controller注入 依赖注入的方式 在使用依赖注入时#xff0c;如果… 标题注入依赖注入的方式通过Set方法注入通过构造方法注入自动注入依赖注入的数据类型注入Bean对象注入基本数据类型和字符串注入List注入Set注入Map注入Properties注解实现IOCComponentRepository、Service、Controller注入 依赖注入的方式 在使用依赖注入时如果注入的是 Bean 对象那么要求注入的 Bean 对象与被注入的 Bean 对象都需要 Spring 通过Set方法注入 需要为注入的成员变量提供 Set 方法。 配置文件 bean idusersDao classcom.bjsxt.dao.impl.UsersDaoImpl/ bean idusersDaoMybatis classcom.bjsxt.dao.impl.UsersDaoImpl/ bean idusersService namename1,name2,name3 classcom.bjsxt.service.impl.UsersServiceImpl!--name要和UsersServiceImpl中属性名相同--property nameusersDaoref beanusersDaoMybatis//property !--property nameusersDao refusersDaoMybatis/-- /beanBean对象 private UsersDao usersDao; public UsersDao getUsersDao() {return usersDao; } public void setUsersDao(UsersDao usersDao) {this.usersDao usersDao; }通过构造方法注入 Bean 对象中需要提供有参的构造方法 配置文件 bean idusersDaoMybatis classcom.bjsxt.dao.impl.UsersDaoMybatisImpl/ bean idusersService namename1, name2, name3 classcom.bjsxt.service.impl.UsersServiceImpl!--property nameusersDao refusersDaoMybatis/--!--一个constructor-arg标签表示构造方法中的一个参数name:根据参数名称识别参数index:根据参数的位置识别参数type:根据参数类型识别参数--constructor-arg typecom.bjsxt.dao.UsersDaoref beanusersDaoMybatis//constructor-arg /bean2.Bean对象 private UsersDao usersDao; public UsersServiceImpl(UsersDao usersDao){this.usersDao usersDao; }自动注入 自动注入的方式有两种一种是全局配置自动注入另一种是局部配置自动注入。 无论全局配置或局部单独配置都有 5 个值可以选择 no当 autowire 设置为 no 的时候Spring 就不会进行自动注入。byName在 Spring 容器中查找 id 与属性名相同的 bean并进行注入。需要提供 set 方 法。byType在 Spring 容器中查找类型与属性名的类型相同的 bean并进行注入。需要提 供 set 方法。constructor仍旧是使用 byName 方式只不过注入的时候使用构造方式进行注入。default全局配置的 default 相当于 no局部的 default 表示使用全局配置设置 局部自动注入通过 bean 标签中的 autowier 属性配置自动注入有效范围仅针对当前 bean 标签生效 全局自动注入通过 beans 标签中的 default-autowire 有效范围配置文件中的所有 bean 依赖注入的数据类型 注入Bean对象 方式一 property nameFieldNameref beanBeanID/ /property方式二 property nameFieldName refBeanID/注入基本数据类型和字符串 方式一 property nameFieldNamevaluecontent/value /property !--content是要传入内容的值--方式二 property nameFieldName valueContent/注入List property nameuserslistbean classcom.bjsxt.pojo.Usersproperty nameusername valueOldlu/property nameuserage value30//beanbean classcom.bjsxt.pojo.Usersproperty nameusername valueadmin/property nameuserage value20//bean/list/property注入Set property nameusersSetsetbean classcom.bjsxt.pojo.Usersproperty nameusername valueOldlu-set/property nameuserage value30//beanbean classcom.bjsxt.pojo.Usersproperty nameusername valueadmin-set/property nameuserage value20//bean/set/property注入Map 方式一 property namemapmapentry keykey1 valuevalue1/entry keykey2 valuevalue2//map/property方式二 bean idusers1 class...... bean idusers1 class...... property nameFieldNamemapentry keykey1 value-refusers1/entry keykey2 value-refusers2//map /property注入Properties property nameFieldName propsprop keyKeyNameContent/prop/props /property注解实现IOC E:\java\Spring\spring_ioc2Component 作用用于创建对象放入Spring容器相当于 bean id class 注意 要在配置文件中配置扫描的包扫描到该注解才能生效。 context:component-scan base-packagecom.itbaizhan /context:component-scan Component 注解配置bean的默认id是首字母小写的类名。也 可以手动设置bean的id值。 / 此时bean的id为studentDaoImpl Component public class StudentDaoImpl implements StudentDao{public Student findById(int id) {// 模拟根据id查询学生return new Student(1,百战程序 员,北京);}}// 此时bean的id为studentDao Component(studentDao) public class StudentDaoImpl implements StudentDao{public Student findById(int id) {// 模拟根据id查询学生return new Student(1,百战程序 员,北京);} }Repository、Service、Controller 作用这三个注解和Component的作用一样使用它们是为了区分该类属于什么层。 Repository用于Dao层Service用于Service层Controller用于Controller层 Scope指定bean的创建策略:singleton prototype request session globalsession
http://www.hkea.cn/news/14366547/

相关文章:

  • 浙江网站建设制作流程抖音推广
  • 做房产经纪人要自己花钱开网站吗网站建设无法访问网站
  • 三亚婚纱摄影 织梦网站源码中江网站建设
  • 集约化网站建设的函免备案网站空间购买
  • 网站建设公司没落免费的网站建设有哪些
  • 网站优化的要求网站免费推广网站
  • 厚街做网站价格学校作业怎么做网站
  • 网站建设刂搜金手指下拉贰肆大连哪个公司做网站好
  • 3分钟搞定网站seo优化外链建设网站建设工作室起名
  • 如何防止网站被镜像医生问诊在线咨询免费
  • 盐城网站建设报价免费seo视频教程
  • 建设网站费用如何做账17网站一起做网店 新塘
  • 杭州网站搜索排名中国建筑工程个人信息网
  • 在国外的网站做推广方案西安网页设计培训
  • 免费网站推广文章wordpress密码
  • 制作表白网站深圳手机端网站建设
  • 上海建站哪家好广告营销模式
  • app软件开发就是网站开发吗wordpress 扁平化主题下载
  • 网站免费关键词如何做北京网站模板建设
  • 泊头市有做网站的吗黄山旅游攻略冬季
  • 南京 高端网站建设电子商务做网站设计
  • cn结尾的网站 做外贸大连建设工程信息网怎么没有了
  • 网站关键词库怎么做手游代理免费平台
  • 江西省赣州市南康区大连百度搜索排名优化
  • 亚马逊德国做deals 网站wordpress邮箱服务器
  • 跨境购物网站建设房地产网站建设意义
  • 房地产网站建设哪家有效果个人社保缴费记录查询
  • 无锡微信网站定制使用nas服务器建设网站
  • 郑州网站app开发的政务网站建设 紧急通知
  • 保险业网站建设网站要实名认证