1. 程式人生 > >applicationContext.getBean(“loginEntity”)

applicationContext.getBean(“loginEntity”)

gin contex code 類型 ack pan action col ati

<!-- 指定Spring需要掃描的包,並將所有是別的類放到容器中,便於識別被註解的受托管bean -->

<context:component-scan base-package="com.sgfm"
scoped-proxy="interfaces">
<context:exclude-filter type="regex"
expression="com.sgfm.base.jms.demo.*" />    <!--掃描這個包下的所有的bean  [email protected] @entity  @service -->
</context:component-scan>

//獲取某個bean的通過類名首字母小寫

eg:

 IndexAction action = (IndexAction) app.getBean("indexAction");

applicationContext.getBean(“loginEntity”)