spring MVC边用边用

来源:互联网 发布:js委托事件 编辑:程序博客网 时间:2024/04/28 02:44


-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------

注入的方式 


1   @Resource(name = "sessionFactory")
public void setaaa(SessionFactory sessionFactory){  
   super.setSessionFactory(sessionFactory);  

sessionFactory是spring.xml定义的

2 @Resource(name = "WtdwxxImpl")
    private  T33WtdwxxService t33wtdwxxServ;

-----------------------------------------------------------------------------------------------------------------------------

<context:component-scan base-package="peter.post"></context:component-scan>

组件扫描的时候要特别注意,peter.post下面所有的包和类可以扫描到,但是如果写成peter.post.*,就只能扫描到下面的包,不能扫描到类,因为*表示包名,不表示类名

-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
0 0
原创粉丝点击