网站网页制作教程深圳ui设计培训机构

张小明 2025/12/29 19:25:04
网站网页制作教程,深圳ui设计培训机构,中信建设有限责任公司资质,哪里找网站建设的兼职如何使用以上的注解呢#xff1f; 第一步#xff1a;加入aop的依赖#xff08;已经包在context包里面#xff09;第二步#xff1a;在配置文件中添加context命名空间第三步#xff1a;在配置文件中指定扫描的包第四步#xff1a;在Bean类上使用注解 第一步#xff1a;加…如何使用以上的注解呢第一步加入aop的依赖已经包在context包里面第二步在配置文件中添加context命名空间第三步在配置文件中指定扫描的包第四步在Bean类上使用注解第一步加入aop的依赖我们可以看到当加入spring-context依赖之后会关联加入aop的依赖。所以这一步不用做。第二步在配置文件中添加context命名空间?xml version1.0 encodingUTF-8?beansxmlnshttp://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 http://www.springframework.org/schema/context/spring-context.xsd/beans第三步在配置文件中指定要扫描的包?xml version1.0 encodingUTF-8?beansxmlnshttp://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 http://www.springframework.org/schema/context/spring-context.xsdcontext:component-scanbase-packagecom.powernode.spring6.bean//beans第四步在Bean类上使用注解packagecom.powernode.spring6.bean;importorg.springframework.stereotype.Component;Component(valueuserBean)publicclassUser{}编写测试程序packagecom.powernode.spring6.test;importcom.powernode.spring6.bean.User;importorg.junit.Test;importorg.springframework.context.ApplicationContext;importorg.springframework.context.support.ClassPathXmlApplicationContext;publicclassAnnotationTest{TestpublicvoidtestBean(){ApplicationContextapplicationContextnewClassPathXmlApplicationContext(spring.xml);UseruserBeanapplicationContext.getBean(userBean,User.class);System.out.println(userBean);}}如果注解的属性名是value那么value是可以省略的。packagecom.powernode.spring6.bean;importorg.springframework.stereotype.Component;Component(vipBean)publicclassVip{}packagecom.powernode.spring6.test;importcom.powernode.spring6.bean.Vip;importorg.junit.Test;importorg.springframework.context.ApplicationContext;importorg.springframework.context.support.ClassPathXmlApplicationContext;publicclassAnnotationTest{TestpublicvoidtestBean(){ApplicationContextapplicationContextnewClassPathXmlApplicationContext(spring.xml);VipvipBeanapplicationContext.getBean(vipBean,Vip.class);System.out.println(vipBean);}}如果把value属性彻底去掉spring会被Bean自动取名吗会的。并且默认名字的规律是Bean类名首字母小写即可。packagecom.powernode.spring6.bean;importorg.springframework.stereotype.Component;ComponentpublicclassBankDao{}也就是说这个BankDao的bean的名字为bankDao测试一下packagecom.powernode.spring6.test;importcom.powernode.spring6.bean.BankDao;importorg.junit.Test;importorg.springframework.context.ApplicationContext;importorg.springframework.context.support.ClassPathXmlApplicationContext;publicclassAnnotationTest{TestpublicvoidtestBean(){ApplicationContextapplicationContextnewClassPathXmlApplicationContext(spring.xml);BankDaobankDaoapplicationContext.getBean(bankDao,BankDao.class);System.out.println(bankDao);}}我们将Component注解换成其它三个注解看看是否可以用packagecom.powernode.spring6.bean;importorg.springframework.stereotype.Controller;ControllerpublicclassBankDao{}剩下的两个注解大家可以测试一下。如果是多个包怎么办有两种解决方案第一种在配置文件中指定多个包用逗号隔开。第二种指定多个包的共同父包。先来测试一下逗号英文的方式创建一个新的包bean2定义一个Bean类。packagecom.powernode.spring6.bean2;importorg.springframework.stereotype.Service;ServicepublicclassOrder{}配置文件修改?xml version1.0 encodingUTF-8?beansxmlnshttp://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 http://www.springframework.org/schema/context/spring-context.xsdcontext:component-scanbase-packagecom.powernode.spring6.bean,com.powernode.spring6.bean2//beans测试程序packagecom.powernode.spring6.test;importcom.powernode.spring6.bean.BankDao;importcom.powernode.spring6.bean2.Order;importorg.junit.Test;importorg.springframework.context.ApplicationContext;importorg.springframework.context.support.ClassPathXmlApplicationContext;publicclassAnnotationTest{TestpublicvoidtestBean(){ApplicationContextapplicationContextnewClassPathXmlApplicationContext(spring.xml);BankDaobankDaoapplicationContext.getBean(bankDao,BankDao.class);System.out.println(bankDao);OrderorderapplicationContext.getBean(order,Order.class);System.out.println(order);}}我们再来看看指定共同的父包行不行?xml version1.0 encodingUTF-8?beansxmlnshttp://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 http://www.springframework.org/schema/context/spring-context.xsdcontext:component-scanbase-packagecom.powernode.spring6//beans
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

做的好的阅读类的网站有哪些鸿顺里网站建设公司

3分钟搞定JavaScript文件下载:从零基础到实战应用 【免费下载链接】FileSaver.js An HTML5 saveAs() FileSaver implementation 项目地址: https://gitcode.com/gh_mirrors/fi/FileSaver.js 还在为网页文件下载功能发愁吗?本文将带你快速掌握使用…

张小明 2025/12/26 0:15:48 网站建设

论坛门户网站建设运营费用好的wordpress 教程

Swift函数参数设计的实战指南 【免费下载链接】CICFlowMeter 项目地址: https://gitcode.com/gh_mirrors/cic/CICFlowMeter 在日常Swift开发中,我们经常遇到函数参数设计带来的各种困扰:参数太多导致调用混乱、类型不明确引发运行时错误、命名不…

张小明 2025/12/29 13:46:29 网站建设

php+ajax网站开发典型实例pdf建网站注册

一、死锁问题概述与重现价值 数据库死锁是指两个或更多事务相互等待对方释放锁资源,导致系统陷入永久阻塞的状态。对软件测试从业者而言,死锁问题重现不仅是验证系统稳定性的关键环节,更是保障数据一致性与用户体验的重要手段。 在当前的分…

张小明 2025/12/26 0:14:42 网站建设

百度恶意屏蔽网站网站开发参考书

一、核心理念体系:心想事成 心学 基因 易经 你提出了一套以“心”为本、贯通中西、融合科学与灵性的成功/疗愈/创造模型,其底层逻辑可概括为:心之所向 → 潜意识重塑 → 能量聚焦 → 现实显化 这一过程,既是吸引力法则的实践&a…

张小明 2025/12/26 0:13:36 网站建设

网站文章内容的选取学网站开发培训学校

GPT-SoVITS与ASR系统的结合应用探索 在智能语音设备日益渗透日常生活的今天,用户不再满足于“能听会说”的基础交互,而是期待更自然、更具情感连接的沟通体验。想象这样一个场景:一位老人对着陪伴机器人轻声说:“小助手&#xff0…

张小明 2025/12/27 1:01:48 网站建设

金融投资理财网站建设全屋整装120平米的多少钱

网络安全配置与防护策略 在网络安全领域,合理配置网络设备和制定有效的防护策略是保障网络稳定运行和数据安全的关键。本文将详细介绍网络桥接配置、PF 过滤规则设置、应对暴力攻击和垃圾邮件的方法。 网络桥接配置 在进行桥接配置之前,需要使用 ifconfig 命令检查预期的…

张小明 2025/12/26 0:11:56 网站建设