spring获取bean的时候严格区分大小写

如题:spring获取bean的时候严格区分大小写

配置文件helloservice.xml中配置:

<dubbo:reference id="IInsurance" interface="xx.xx.asdf.IHelloService" timeout="500000" url="dubbo://172.XXX.XXX.XXX:20880"/>

代码中:

ApplicationContext ctx=new ClassPathXmlApplicationContext("helloservice.xml");

IInsuranceSearchService insService=(IInsuranceSearchService)ctx.getBean("IInsurance");//IInsurance

则可获取成功

但是如果是:

ApplicationContext ctx=new ClassPathXmlApplicationContext("helloservice.xml");

IInsuranceSearchService insService=(IInsuranceSearchService)ctx.getBean("iInsurance");//iInsurance

则失败

时间: 2024-08-01 22:47:42

spring获取bean的时候严格区分大小写的相关文章

spring 获取 bean

ApplicationContext ac1 = WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext()); TopicAction result = (TopicAction)ac1.getBean("TopicAction"); spring 获取 bean

Spring获取bean

1.在spring-servlet.xml中配置 <!--业务类的配置--> <bean id="locationTaskService" class="com.location.service.LocationTaskServiceImpl"></bean> 2.添加获取bean的代码 ApplicationContext ac=new ClassPathXmlApplicationContext("spring-se

Spring获取bean的一种方式

随便一百度,网上一大把,并且还不止一种.所以这里就只记录目前用的一种好了. 实现ApplicationContextAware接口 即可: import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.sprin

Spring获取Bean示例的最佳方式-SpringContextUtil

最近在做项目中,遇到这样的问题,网上搜索了好多, Java代码   //      ApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml","spring-xxxxx.xml"}); //      BeanFactory factory = (BeanFactory)context; //      MonitorSe

Spring 获取bean 几种方式

转载自: http://www.cnblogs.com/luoluoshidafu/p/5659574.html 1.读取xml文件的方式,这种在初学入门的时候比较适用 . ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:tt.xml"); ApplicationContext applicationContext = new FileSystemXmlAppli

spring 获取bean的几种方式

1.读取xml文件的方式,这种在初学入门的时候比较适用 . ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:tt.xml"); ApplicationContext applicationContext = new FileSystemXmlApplicationContext("classpath:tt.xml"); 2.继承spring的A

【Spring 系列】一、如何从spring中获取bean

导包 spring要管理的类信息 package com.liuyong666.service.impl; ? import com.liuyong666.service.PersonService; public class PersonServiceBean implements PersonService { @Override public void save(){ System.out.println("我是save()方法"); } } spring面向接口编程,该类对应的

Spring在代码中获取bean的几种方式(转:http://www.dexcoder.com/selfly/article/326)

方法一:在初始化时保存ApplicationContext对象 方法二:通过Spring提供的utils类获取ApplicationContext对象 方法三:继承自抽象类ApplicationObjectSupport 方法四:继承自抽象类WebApplicationObjectSupport 方法五:实现接口ApplicationContextAware 方法六:通过Spring提供的ContextLoader 获取spring中bean的方式总结: 方法一:在初始化时保存Applicati

Spring获取ApplicationContext方式,和读取配置文件获取bean的几种方式

转自:http://chinazhaokeke.blog.163.com/blog/static/109409055201092811354236  Spring获取ApplicationContext方式 我自己常用的方法: 读取一个文件1 //创建Spring容器 2 ApplicationContext ctx = new ClassPathXmlApplicationContext("bean.xml"); 3 //获取chinese 实例 4 Person p = ctx.g