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的项目 第二步:填写项目的相关信息, ...
随机推荐
- MySQL学习(四)
1 MySQL日期和时间类型 创建一个包含DATE类型的表 mysql> create table test3( -> star varchar(20) not null default ...
- Qt网络应用开发初步
应用层的网络协议,如HTTP/FTP/SMTP等简称"应用协议",他们运行在TCP/UDP之上,从Qt5开始,已经不再分别提供QHttp类,QFtp类,应用层的编程使用QNet ...
- Qt5获取本机网络信息
获取本机网络信息 在pro文件中加入如下代码 QT += network widget.h中的代码如下 #ifndef WIDGET_H #define WIDGET_H #include <Q ...
- Linux实际常用命令
1.删除0字节文件 find -type f -size 0 -exec rm -rf {} \; 2.查看进程 按内存从大到小排列 ps -e -o “%C : %p : %z : %a”|sor ...
- JAVA中Action层, Service层 ,modle层 和 Dao层的功能区分
Dao层是使用了Hibernate连接数据库.操作数据库(增删改查).Service层:引用对应的Dao数据库操作,在这里可以编写自己需要的代码(比如简单的判断).Action层:引用对应的Servi ...
- lua中产生 1 - n 之间不重复随机数
local function GetRandomNumList(len) local rsList = {} ,len do table.insert(rsList,i) end local num, ...
- traceback模块——获取详细的异常信息
try: 1/0 except Exception,e: print e 输出结果是integer division or modulo by zero,只知道是报了这个错,但是却不知道在哪个文件哪个 ...
- 第 6 章 存储 - 038 - Docker 的两类存储资源
存储资源 Docker 为容器提供了两种存放数据的资源: 由 storage driver 管理的镜像层和容器层 Data Volume 1.storage driver 容器由最上面一个可写的容器层 ...
- (转)c#反射
1. 什么是反射2. 命名空间与装配件的关系3. 运行期得到类型信息有什么用4. 如何使用反射获取类型5. 如何根据类型来动态创建对象6. 如何获取方法以及动态调用方法7. 动态创建委托 1.什么是反 ...
- caffe在solverstate的基础上继续训练模型
以mnist数据集为例: bat训练脚本: Build\x64\Release\caffe.exe train --solver=examples/mnist/lenet_solver.prototx ...