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



  • 相关阅读:
    【Python数据分析】NumPy之数组对象基础
    【Oracle11g】20_函数
    【Word】排版技巧
    cache介绍
    cache verilog实现
    在verilog中使用格雷码
    同步fifo与异步fifo
    AHB总线协议(二)
    Android Handler 消息机制原理解析
    值得推荐的开源C/C++框架和库
  • 原文地址:https://www.cnblogs.com/attilax/p/15199370.html
Copyright © 2011-2022 走看看