• 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

  • 相关阅读:
    文字列をバイトで切る
    把SmartForm转换成PDF
    相对布局和网格布局
    帧布局和表格布局
    计算器布局
    课堂总结和练习
    Android UI组件
    2层导航
    导航
    课堂总结
  • 原文地址:https://www.cnblogs.com/unixshell/p/3417212.html
Copyright © 2020-2023  润新知