Spring-framework
1、spring注解驱动开发 官方文档
- @Configuration 告诉spring这是一个配置类,配置类=配置文件
- @Bean 给容器中注入一个bean,类型为返回值类型,id默认用方法名作为id
@Bean
public Person person(){
return new Person("Jack",22);
}
- 获取bean
ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfig.class);
Person person = applicationContext.getBean(Person.class);
System.out.println("person:"+person);
- 获取容器中bean数组:String[] names = applicationContext.getBeanDefinitionNames();
- @ComponentScan(value = "com.hbut") 包扫描器,指定要扫描的包。配置在配置类上面。
@ComponentScan(value = "com.hbut",excludeFilters = {@ComponentScan.Filter(type =FilterType.ANNOTATION,classes = {Controller.class, Service.class})}) //包扫描,按注解排除,排除Controller和service
@ComponentScan(value = "com.hbut",includeFilters = {@ComponentScan.Filter(type =FilterType.ANNOTATION,classes = {Controller.class, Service.class})},useDefaultFilters =false) // 包扫描,只需要service和controller
Spring-framework的更多相关文章
- 浅谈对Spring Framework的认识
Spring Framework,作为一个应用框架,官方的介绍如下: The Spring Framework provides a comprehensive programming and con ...
- Hello Spring Framework——依赖注入(DI)与控制翻转(IoC)
又到年关了,还有几天就是春节.趁最后还有些时间,复习一下Spring的官方文档. 写在前面的话: Spring是我首次开始尝试通过官方文档来学习的框架(以前学习Struts和Hibernate都大多是 ...
- 手动创建Spring项目 Spring framework
之前学习框架一直是看的视频教程,并且在都配套有项目源码,跟着视频敲代码总是很简单,现在想深入了解,自己从官网下载文件手动搭建,就遇到了很多问题记载如下. 首先熟悉一下spring的官方网站:http: ...
- 转-Spring Framework中的AOP之around通知
Spring Framework中的AOP之around通知 http://blog.csdn.net/xiaoliang_xie/article/details/7049183 标签: spring ...
- spring 官方下载地址(Spring Framework 3.2.x&Spring Framework 4.0.x)
spring官方网站改版后,建议都是通过 Maven和Gradle下载,对不使用Maven和Gradle开发项目的,下载就非常麻烦,下给出Spring Framework jar官方直接下载路径: h ...
- Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->Spring Framework中的spring web MVC模块
spring framework中的spring web MVC模块 1.概述 spring web mvc是spring框架中的一个模块 spring web mvc实现了web的MVC架构模式,可 ...
- Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->Spring Framework中web相关的知识(概述)
Spring Framework中web相关的知识 1.概述: 参考资料:官网documentation中第22小节内容 关于spring web mvc: spring framework中拥有自 ...
- Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->关于spring framework中的beans
Spring framework中的beans 1.概述 bean其实就是各个类实例化后的对象,即objects spring framework的IOC容器所管理的基本单元就是bean spring ...
- Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->使用spring framework的IoC容器功能----->方法一:使用XML文件定义beans之间的依赖注入关系
XML-based configuration metadata(使用XML文件定义beans之间的依赖注入关系) 第一部分 编程思路概述 step1,在XML文件中定义各个bean之间的依赖关系. ...
- Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->使用Spring Framework开发自己的应用程序
1.直接基于spring framework开发自己的应用程序: 1.1参考资料: Spring官网spring-framework.4.3.5.RELAESE的Reference Documenta ...
随机推荐
- Ext.override
Ext.override:4种情况 如果target是使用Ext.define声明的一个类,给出overrides那个类的override方法被调用(看Ext.Base.override) If th ...
- java-文件读取
1.利用递归读取文件 (1)NotifyFolder.java package com.etc; import java.io.File; import java.io.IOException; im ...
- 轨迹系列7——Socket总结及实现基于TCP或UDP的809协议方法
文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1.背景 在上一篇博客中我详细介绍了809协议的内容.809协议规范了通 ...
- Dynamics 365 Online-Microsoft Flow
自December 2016 update for Dynamics 365 (online)之后的Online版本,Dynamics 365有了个新Feature:Microsoft Flow Co ...
- 解决注册并发问题并提高QPS
前言:前面在本地的windows通过apache的ab工具测试了600并发下“查询指定手机是否存在再提交数据”的注册功能会出现重复提交的情况,并且在注册完成时还需要对邀请人进行奖励,记录邀请记录,对该 ...
- Vue2开发大全
参考资料: vuex element qs.js axios.js vue promise 关于ES6的Promise的使用深入理解 vue2 设置网页title的问题 Mint UI websto ...
- Linux tail 命令
tail 命令可用于查看文件的内容,有一个常用的参数 -f 常用于查阅正在改变的日志文件. tail -f filename 会把 filename 文件里的最尾部的内容显示在屏幕上,并且不断刷新,只 ...
- unity can't add the script behaviour CallbackExecutor. The script needs ...
记一次Unity3D小问题 当我打开VS2017编辑完C#脚本,要将脚本拖到一个3D组件上时,发生了以下错误 unity can't add the script behaviour Callback ...
- 给IConfiguration写一个GetAppSetting扩展方法
给 IConfiguration 写一个 GetAppSetting 扩展方法 Intro 在 .net core 中,微软已经默认使用 appsettings.json 来代替 app.config ...
- Axure RP 8 注册码
升级了8.1.0.3377版本后,需要使用下面这组注册码 许可:zdfans.com 重点:gP5uuK2gH + iIVO3YFZwoKyxAdHpXRGNnZWN8Obntqv7 ++ FF3pA ...