一、导入jar包
二、配置applicationcontext.xml的spring核心配置
三、
public static void main(string[] args) { //1.使用 applicationcontext 接口,就是在获取 spring 容器 applicationcontext ac = new classpathxmlapplicationcontext("bean.xml"); //2.根据 bean 的 id 获取对象 iaccountservice aservice = (iaccountservice) ac.getbean("accountservice"); system.out.println(aservice); iaccountdao adao = (iaccountdao) ac.getbean("accountdao"); system.out.println(adao); }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。
如对本文有疑问, 点击进行留言回复!!
SpringBoot实现本地存储文件上传及提供HTTP访问服务的方法
Java实现AES/CBC/PKCS7Padding加解密的方法
SpringBoot整合Spring Security的详细教程
IDEA 非常重要的一些设置项(一连串的问题差点让我重新用回 Eclipse)
详解Springboot2.3集成Spring security 框架(原生集成)
网友评论