########## Part 1 spring basics ############
I. Overview
1, Brief History
Phase 1: xml configuration. spring 1.x
Phase 2: Annotation configuration. spring 2.x
Phase 3: java configuration. spring 3.x till now
2, spring module
3, spring ecology
spring boot: use default development configuration for rapid development
spring XD: used to simplify big data application development
spring Cloud: provides integrated tools for distributed development
spring Data: support for mainstream relational and nosql databases
spring Integration: support for EIP via message mechanism
Spring security
spring Batch: Simplify or optimize batch operations for large amounts of data
spring HATEOAS
spring social
spring AMQP
spring mobile
spring for Android
spring web flow
spring web services
spring LDAP
4, project construction
eclipse + maven abbreviation
IDEA abbreviation
5, Basic configuration
Four principles:
Lightweight and minimally invasive development with POJOs
Loose coupling through dependency injection and interface-based programming
Declarative programming with AOP and default habits
Reduce modular code with AOP and templates
1), Dependency Injection
Annotations for declaring beans
@Component
@Service
@Repository is used in the data access layer (dao layer)
@Controller
@Configuration 声明当前类是个配置类,相当于一个配置文件
@ComonentScan 自动扫描包下所有使用 @Component,@Service, @Repository, @Controller的类
注入Bean的注解
@Autowire
@Inject JSR330提供
@Resource
@Bean
2), AOP
@Aspect
@After
@Before
@Around
@PointCut
############### 第二部分 spring boot 基础 ###################
Spring Boot: 减少配置,提高效率,降低部署流程.
一,核心功能
spring Boot可以以一个jar包的形式独立运行. e.g. java -jar xx.jar
可选择内嵌tomcat ,jetty, undertow, 无需以war形式部署
提供starter简化Maven配置
自动配置spring
准生产的应用监控
无代码生产和xml配置
二, 优缺点
优点:
快速构建项目
嵌入的Tomcat,无需部署WAR文件
自动配置Spring
绝对没有代码生成和对XML没有要求配置
对主流开发框架的无配置集成
项目可独立运行
提供运行时的应用监控
极大的提高了开发,部署效率
与云计算天然集成
缺点:
书籍文档少,不够深入
三 快速搭建
对于Eclipse开发可使用Spring Tool Suite快速搭建
STS简介可参考: https://www.cnblogs.com/larryzeal/p/5800980.html
STS下载URL: http://spring.io/tools/sts/all
Sprin Boot CLI: 是spring boot提供的控制台命令工具
安装: http://blog.csdn.net/qq_33589510/article/details/68941670