SpringBoot document notes
图片拷贝不过来,直接从github上下载 。
链接: https://github.com/DFX339/SpringBootDocumentNotes.git
Create a example
pom.xml
Controller:
The defferent between @RestController and @Controller:
@Controller could return jsp、html or (add @ResponseBody to return json)json
@RestController just could return json.
@RestController = @Controller +@ResponseBody
@EnableAutoConfiguration: aim to tell springboot how to configure spring.
Main method: to auto starting spring,auto starting the tomcat web server.
When you see that your demo is successful.
@SpringBootApplication on you main class.
Locate you main class above other clasese package.
@SpringBootApplication = @EnableAutoConfiguration +@ComponentScan
Main class demo with use the @SpringBootApplication
@Configuration: load one class
@Import : load one special class
@ComponentScan: load all spring conponent.
@Configuration to configure xml
@Configuration :Recommend this annotations
@EnableAutoConfiguration : use this could auto configuration
@EnableAutoConfiguration : to Ingnore some class
@ComponentScan : find you beans
@Autowired: inject object by constructor.
Structrue codes to use @ComponentScan:
@Repository:always use to annotation the Dao
Default configure file name. application.properties
@SpringBootApplication = @EnableAutoConfiguration + @Configuration + @ComponentScan
Use @EnableAutoConfiguration @Configuration @Import to annotation main class instead of @SpringBootApplication demo.
@Import : point at some specific classes.
@Component: point at all class.
Springboot-devtools: A powerrful dependency!
Disable to cache in default.
If some files be modified ,the springboot- devtool will restart this program auto.
Restart detailed analysis: springboot worked with two classloaders.
Restart logs: you can figure out it by configuring in application.properties.
spring.devtools.restart.log-condition-evaluation-delta=false
Eclude some files ,project would not to restart when they are changed
Springboot devtool default to start,you can stop it by modifying the System param.
Trigger a brower refresh. (auto)
Use the configure file name definitied by self. Composed with –spring.config.name=Xxxxxx
Use specific configuration
@EnableConfigurationProperties:all class be annotated by @ConfigurationProperties
Use @Valitaded anotations to validate attributes
Ouput the log fiiles
Springboot support tomcat/jetty ,the default port is 8080
Springboot servlet
Use springboot servlet
Configure springboot servlet in application.properties
Demo in springboot servlet
Modify the port in tomcat
Connect to mysql database;
Tomcat connect pool
Entity Class use @Entity annotations
JOOQ: java object orentied query
Springboot user redis
Connect redis
Springboot provides lots of databases,sql or nosql ,all of those will have XXXTemplate instance to operate.
Springboot cache use demo:
JMS: java message service
JMS-ActionMq:use demo:
JMS send meassages:
RabbitMQ
Send mesages:
Receive messages:
Use restTemplate by RestTemplateBuilder
Use webClient by WebClientBuilder
Springboot use quartz scheduler
50.5
SpringBoot document notes的更多相关文章
- vim calendar插件配置
近日学习markdown,试着记个日志,安装了vim的知名插件calendar:https://github.com/mattn/calendar-vim. 使用网上配置,发现回车之后日期是昨天的,于 ...
- Vulkan(1)用apispec生成Vulkan库
Vulkan(1)用apispec生成Vulkan库 我的Vulkan.net库已在(https://github.com/bitzhuwei/Vulkan.net)开源,欢迎交流. apispec. ...
- Azure Active Directory document ---reading notes
微软利用本地活动目录 Windows Server Active Directory 进行身份认证管理方面具有丰富的经验,现在这一优势已延伸基于云平台的Azure Active Directory.可 ...
- Django notes I: collection of links to the Django document
Links to the Django documents: the Django template language automatically generated context variable ...
- SpringBoot和mybatis整合报错:Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 152; columnNumber: 10; 元素类型为 "mapper"
很明显,报错是xml有问题,于是去检查,发现: 由于粗心,保存的时候,按的太频繁,多按了个s在里面,导致启动报错!
- [idea] SpringBoot整合swagger2实现CRUD
一:创建SpringBoot ,在pom.xml文件中加入jar包 <dependency> <groupId>io.springfox</groupId> < ...
- springboot 集成swagger2
使用Swagger 可以动态生成Api接口文档,在项目开发过程中可以帮助前端开发同事减少和后端同事的沟通成本,而是直接参照生成的API接口文档进行开发,提高了开发效率.这里以springboot(版本 ...
- SpringBoot 集成Swagger2自动生成文档和导出成静态文件
目录 1. 简介 2. 集成Swagger2 2.1 导入Swagger库 2.2 配置Swagger基本信息 2.3 使用Swagger注解 2.4 文档效果图 3. 常用注解介绍 4. Swagg ...
- SpringBoot整合开发
1.SpringBoot分模块 分模块就是将一个项目分成多个模块,即maven项目. 1)首先创建一个springboot的项目: 第一步:选择springboot的项目 第二步:填写项目的相关信息, ...
随机推荐
- 了解java中垃圾回收机制
Java的垃圾回收机制是Java环境自带有的,它不像c语言的malloc申请空间后需要Free()函数来释放,而Java中的代码块中所申请的空间可在程序执行完成后自动释放,但是是有局限性的,代码块所占 ...
- sublime编辑器
1.完全卸载sublime的方法. 打开preferences->browse packages 这个包,打开的那个目录,然后删除完整的sublime Text3目录就行. 2.sublime的 ...
- JavaScript学习第一天(一)
JavaScript介绍 JavaScript一种直译式脚本语言,是一种动态类型.弱类型.基于原型的语言,内置支持类型.它的解释器被称为JavaScript引擎,为浏览器的一部分,广泛用于客户端的脚本 ...
- nginx如何处理请求
有必要了解一下nginx转发请求的方式,弄清它是如何转发请求的对我们理解nginx的server块的配置很有意义(虽然我也还不是很明白) 上一节说了配置文件中可以有多个server块,所以这里我配置2 ...
- 数据结构(C语言版)-第7章 查找
7.1 查找的基本概念 查找表: 由同一类型的数据元素(或记录)构成的集合静态查找表: 查找的同时对查找表不做修改操作(如插入和删除)动态查找表: 查找的同时对查找表具有修改操作关键 ...
- 输出图片格式BARTENDER
try { BarTender.Application btApp = new BarTender.Application(); BarTe ...
- 分离vue组件内部css
当我们使用vue组件的时候,使用webpack打包的时候,默认会把vue组件内部的css打包到页面上,但是打包到页面上很丑陋,所以我们希望可以把vue组件内部的css抽离到css文件中,使用vue-s ...
- hihocoder-1419 后缀数组四·重复旋律4 求连续重复次数最多的子串
对于重复次数,如果确定了重复子串的长度len,那重复次数k=lcp(start,start+len)/len+1.而暴力枚举start和len的复杂度是O(n^2),不能接受.而有一个规律,若我们只枚 ...
- Confluence 6 应该如何在我的空间中组织内容
页面和博客 你在 Confluence 中创建的任何内容,从会议记录到回顾和任何中间的内容,不管来源是博客和页面. 你的主页将是任何访问你网站中的用户首先看到的内容.为了让用户更加容易的找到他们需要查 ...
- Spring Framework启动详解
之前一直对Spring启动的过程很迷糊,所以这次国庆梳理一下. Spring启动一言以蔽之:创建一个根应用上下文.(因为其他的所有的应用上下文都可以通过各种方式继承它) (一)了解应用上下文 Spri ...