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

  • 相关阅读:
    Oracle与MySQL的几点区别
    MySQL使用Union创建视图报错
    MySQL指定mysqld启动时所加载的配置文件
    MySQL使用位运算
    django rest framework(3)
    Django Rest Framework(2)
    Django 之缓存
    RESTful API
    restful framework 认证源码流程
    其他排序
  • 原文地址:https://www.cnblogs.com/unixshell/p/3417212.html
Copyright © 2011-2022 走看看