zoukankan      html  css  js  c++  java
  • Spring 配置自动扫描spring bean配置

    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"
        default-autowire="byName" default-lazy-init="true">
    
        <context:annotation-config />
        <context:component-scan base-package="com.wolfgang"></context:component-scan>

    这样在类中

    @Service("xxx")

    写在service类的类定义上面,注入dao的地方

    @Resource

    private IxxxDao xxdao

    在IxxxDao接口实现的类定义上方,写上

    @Repository("xxdao")

    xxxDaoImpl implements IXXXDao

  • 相关阅读:
    快速排序
    归并排序
    python module的结构
    HTTPResponse.read([amt]):只能read一次
    本地文件上传到远程服务器
    HTTP POST发消息
    64. 最小路径和-python
    322.零钱兑换-python
    把二叉树打印成多行 -python
    按之字形顺序打印二叉树 -python
  • 原文地址:https://www.cnblogs.com/unixshell/p/3417212.html
Copyright © 2011-2022 走看看