zoukankan      html  css  js  c++  java
  • paip.spring 获取bean getBean 没有beanid的情况下

    paip.spring 获取bean  getBean 没有beanid的情况下


    spring能自动扫描带有注解的bean文件..


    作者Attilax  艾龙,  EMAIL:1466519819@qq.com 
    来源:attilax的专栏
    地址:http://blog.csdn.net/attilax


    设置
        <context:annotation-config />
    <context:component-scan base-package="com.mijie.homi.search.dao.**"/>
    <context:component-scan base-package="com.mijie.homi.search.service.**"/> 
    这个时候儿,没有beanid在app.xml以及java文件中...
    默认那是class名称,第一的字母小写..MoodUserIndexService.java >>>>   moodUserIndexService


    ApplicationContext act=new FileSystemXmlApplicationContext("classpath:applicationContext.xml"); 
    MoodUserIndexService moodUserService=  (MoodUserIndexService) act.getBean("moodUserIndexService"); 


    参考
    在应用程序中怎么自动加载Spring,并注入sessionFactory - ITeye问答.htm
    Spring@Autowired注解与自动装配 - - 博客频道 - CSDN.NET.htm
    Spring注解@Componen、@Repository@Service、@Controller区别 - 豆丁网.htm



  • 相关阅读:
    60. 搜索插入位置
    62. 搜索旋转排序数组
    101. 删除排序数组中的重复数字 II
    397. 最长上升连续子序列
    172. 删除元素
    31. 数组划分
    100. 删除排序数组中的重复数字
    407. 加一
    412. 分糖果
    14. 二分查找
  • 原文地址:https://www.cnblogs.com/attilax/p/5964126.html
Copyright © 2011-2022 走看看