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学习(十四)
utf8的bom问题 在xp下,用记事本创建utf8文件的时候,前面多了3个字节,这3个字节不用来显示,是用来辨识编码用的,EF BB BF告诉记事本,这是utf8编码. 存储引擎和事务简单介绍 引擎 ...
- unittest单元测试简单介绍
unittest单元测试框架不仅可以适用于单元测试,还可以适用WEB自动化测试用例的开发与执行,该测试框架可组织执行测试用例,并且提供了丰富的断言方法,判断测试用例是否通过,最终生成测试结果.今天笔者 ...
- Unity中利用光线投射实现摄像机拉近追踪对象
项目中要求实现摄像机跟踪人物移动,并且可以水平360°,上下接近180°的自由旋转.这些操作网上已近有很多版本的实现,在此不再赘述.我在此想说的是,当摄像机移动到场景边界,或者触碰到场景中的障碍物的时 ...
- Memcached遇到的问题及解决办法
1. memcached make: *** No targets specified and no makefile found. Stop. 其实是因为在安装libevent时增加了版本号导致的, ...
- boke练习: spring boot: security post数据时,要么关闭crst,要么添加隐藏域
spring boot: security post数据时,要么关闭crst,要么添加隐藏域 http.csrf().disable(); 或者: <input name="${_cs ...
- C#生成XSD规范
首先在开始菜单中找到:Visual Studio 2005 命令提示 大柏树按:VS2010在:开始—> Microsoft Visual Studio 2010 —> Visual St ...
- Find the duplicate Number (鸽巢原理) leetcode java
问题描述: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive ...
- vue开发移动端项目 过渡动画问题
App.vue: <div id="app"> <div class="content"> <transition :name ...
- Spring的几种注入bean的方式
在Spring容器中为一个bean配置依赖注入有三种方式: · 使用属性的setter方法注入 这是最常用的方式: · 使用构造器注入: · 使用Filed注入(用于注解方式). 使用属性的se ...
- OCP-1Z0-051-V9.02-13题 单引号的使用
13. View the Exhibit and examine the structure of the PRODUCTS table. You need to generate a report ...