springboot:
1.@springbootapplication注解;包含springbootconfiguration,@enableAutocConfiguration,@conpenentScan.
@springbootConfiguration标注当前类是配置类,这个类继承@Configuration,被标注的类等于在spring的XML配置文件中(applicationContext.xml),装配所有bean事务,提供了一个spring的上下文环境。
@EnableAutoConfiguration自动配置的注解,这个注解会根据我们添加的组件jar来完成一些默认配置,我们做微服务时会添加spring-boot-starter-web这个组件的pom依赖,这样配置会默认配置springmvc和tomcat。
@componentScan扫描当前包及其子包下被@component,@controller,@service,@repository标记的的类纳入到spring容器中进行管理,等价于<content :component-scan>的xml配置项;
2.@propertySource,@import ,@importSource加载配置文件。
3.@servletComponentScan在启动类上使用此注解后可以直接使用@webservlet @webfilter@weblisener自动的注册。
4.controller层:@restcontroller,@controller,@requstmapping,@requstbody,@requstparam @pathvariable,@responcebody
5.service层注解: @service @autowired(spring提供) @resouce(属于javaee规范),@bean
6.dao层注解:@repository @mapper @compnent @configuration @transactional
7.异常处理 类上@restcontrolleradvice ;方法上@exceptionhandle(异常类名)
spring cloud:
1.@enableEurekaServer在springboot启动类上,表示这是一个eureka注册中心。
2.@enableDiscoveryClient用在springboot启动类上表示这个一个微服务给注册中心注册;
3.@loadbalanced开启负载均衡
1.注册发现2.ribbon;3.熔断器(调用的微服务时微服务挂了,执行回调方法) 4.网关 5.配置中心