boot

spring boot集成mybatis(1)

。_饼干妹妹 提交于 2019-11-30 02:36:48
Spring Boot 集成教程 Spring Boot 介绍 Spring Boot 开发环境搭建(Eclipse) Spring Boot Hello World (restful接口)例子 spring boot 连接Mysql spring boot配置druid连接池连接mysql spring boot集成mybatis(1) spring boot集成mybatis(2) – 使用pagehelper实现分页 spring boot集成mybatis(3) – mybatis generator 配置 spring boot 接口返回值封装 spring boot输入数据校验(validation) spring boot rest 接口集成 spring security(1) – 最简配置 spring boot rest 接口集成 spring security(2) – JWT配置 spring boot 异常(exception)处理 spring boot 环境配置(profile)切换 spring boot redis 缓存(cache)集成 概述 MyBatis是一个开源的持久层框架,现在互联网项目使用比较多,MyBatis简化了Java应用程序中对数据库的访问,实现了诸如动态SQL、结果集映射等,高效又不失灵活,简单地说

spring boot启动原理

久未见 提交于 2019-11-30 01:50:52
@SpringBootApplication注解是Spring Boot的核心注解,它其实是一个组合注解: @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan(excludeFilters = { @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class), @Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class) }) public @interface SpringBootApplication { ... } 主要组合了@Configuration、@EnableAutoConfiguration、@ComponentScan SpringBootApplication的核心功能是由@EnableAutoConfiguration提供的。 @Target({ ElementType.TYPE }) @Retention(RetentionPolicy

年轻人的第一个自定义 Spring Boot Starter!

眉间皱痕 提交于 2019-11-30 01:45:47
陆陆续续,零零散散,栈长已经写了几十篇 Spring Boot 系列文章了,其中有介绍到 Spring Boot Starters 启动器 ,使用的、介绍的都是第三方的 Starters ,那如何开发一个自己的 Spring Boot Starter 呢? 下面带大家开发一个年轻人的第一个 Spring Boot Starter! 不知道 Starters 为何物的请进这个传送门===> Spring Boot Starters 启动器 ,看完有了学习基础,我们再继续下面的自定义 Starter 实战! 一、自定义 Starter 必备组件 一个完整的 Spring Boot Starter 需要包含以下组件: 包含自动配置代码的自动配置模块;参考: Spring Boot自动配置原理、实战 。 Starter模块提供对自动模块的依赖关系,和相关依赖库,以及任何需要用到的依赖。简而言之,就是,添加一个 Starter 就应该提供使用该 Starter 所需的一切; 二、创建一个自定义Starter 怎么创建 Spring Boot 项目就不说了,之前也分享过,参考: 年轻人的第一个 Spring Boot 应用! 。 这个自定义 Starter 就实现一个根据属性的值是否配置Bean。 1、创建自动配置类 package cn.javastack.springboot

Android Recovery升级原理

会有一股神秘感。 提交于 2019-11-30 01:23:06
摘要 Recovery模式指的是一种可以对安卓机内部的数据或系统进行修改的模式(类似于windows PE或DOS)。也可以称之为安卓的恢复模式,在这个所谓的恢复模式下,我们可以刷入新的安卓系统,或者对已有的系统进行备份或升级,也可以在此恢复出厂设置(格式化数据和缓存)。 1. Recovery相关概念 Recovery: Recovery模式指的是一种可以对安卓机内部的数据或系统进行修改的模式,也指Android的Recovery分区 OTA: Over-the-Air Technology,即空中下载技术,是 Android 系统提供的标准软件升级方式。 它功能强大,提供了完全升级、增量升级模式,可以通过 SD 卡升级,也可以通过网络升级。不管是哪种方式,都有几个过程:生成升级包、下载升级包、安装升级包。 RecoverySystem:Android系统内部实现的一个工具类,Android应用层操作Recovery模式的一个重要途径,它提供了几个重要的API,用于实现OTA包校验、升级以及恢复出厂设置(格式化数据和缓存)。 Main System:主系统模式,即Android正常开机所进入的Android系统 Bootloader:Bootloader是嵌入式系统在加电后执行的第一段代码,在它完成CPU和相关硬件的初始化之后

Spring Boot:通过spring-boot-starter-data-redis源码了解starter和autoconfigure模块

江枫思渺然 提交于 2019-11-30 01:19:59
注:本文Spring Boot为2.X版本 在Spring Boot中,官方提供了 spring-boot-autoconfigure 包和starter包用来帮助我们简化配置,比如之前要建一个Spring mvc项目,需要我们配置web.xml,dispatcherservlet-servlet.xml,applicationContext.xml等等。而在Spring Boot中只需要在pom中引入 < dependency > < groupId > org.springframework.boot </ groupId > < artifactId > spring-boot-starter-web </ artifactId > </ dependency > 就能完成之前所有的工作了。简直so easy啊。 但是只会用是不行的,还要知其所以然,本文以官方的starter: spring-boot-starter-data-redis 为例,从源码层面上分析整个自动化配置的过程。以期对starter和autoconfigure这两个Spring Boot的核心模块进行梳理。 了解原理后,我会通过模拟 spring-boot-starter-data-redis ,并使用Jedis来创建一个处理redis的自定义starter: my-redis-starter 。源码下载

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:run

折月煮酒 提交于 2019-11-30 01:18:33
今天给同事部署一个springboot的项目,项目采用的是springboot的maven插件 spring-boot-maven-plugin进行run的,用了插件的goal:spring-boot:run来启动项目的,结果一直报错: [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:run (default-cli) on project beijing-ces: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:run failed: Unable to load the mojo 'run' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/springframework

【Spring Boot 从零学习】10 SpringBoot源码讲解 - ComponentScan讲解

最后都变了- 提交于 2019-11-30 01:01:16
1.核心注解@ComponentScan 作用范围扫描的方式,扫描特定的注解,将其注册到Spring ioc容器中 @ComponentScan( excludeFilters = {@Filter( type = FilterType.CUSTOM, classes = {TypeExcludeFilter.class} ), @Filter( type = FilterType.CUSTOM, classes = {AutoConfigurationExcludeFilter.class} )} ) excludeFilters:过滤不需要扫描的类型。 @Filter 过滤注解 FilterType.CUSTOM 过滤类型为自定义规则,即指定特定的class classes :过滤指定的class,即剔除了TypeExcludeFilter.class、AutoConfigurationExcludeFilter.class 从以上源码,我们可以得出结论: 1.@SpringBootApplication的源码包含了@ComponentScan, 故,只要@SpringBootApplication注解的所在的包及其下级包,都会讲class扫描到并装入spring ioc容器 2.如果你自定义的定义一个Spring bean,不在

Spring Boot 和 Grails 的不同点

戏子无情 提交于 2019-11-30 00:51:06
最近花了些时间了解了一下 Spring Boot 这个新框架。这个框架提供了快速开发基于 Spring Framework 的应用的功能。同样,SpringSource 旗下还有另一个用于 Web 应用快速开发的框架,就是 Grails。初看来这两个框架有很多相似的地方,所以可以将这两个框架做一下对比。 Spring Boot 强调自运行;Grails 应用则需要打包成 WAR 来运行 当然 Grails 应用也能通过内嵌的 Tomcat 或 Jetty 容器来运行,但这主要用于开发环境。在用于生产环境时,Grails 应用仍需要打包成 WAR 包。而 Spring Boot 的应用则主要是打包成可自运行的 JAR 包。 Spring Boot 侧重开发 RESTful Web Service;Grails 则提供了全面的 Web 应用支持,包括页面标签、Web 视图等等 Spring Boot 使用 Maven 和 Gradle 作为构建工具;Grails 使用自有的构建工具 Maven 和 Gradle 显然是两个最为广泛使用的构建工具。从构建工具的角度看,Spring Boot 更有通用性。而如果要用 Maven 去构建 Grails 应用倒也不难,但是需要一些并不复杂的额外工作。不过如果想用 Gradle 构建 Grails 应用那就更加麻烦一些了。 PS. 在使用

spring boot 项目从配置文件中读取maven 的pom.xml 文件标签的内容。

巧了我就是萌 提交于 2019-11-30 00:26:22
需求: 将pom.xml 文件中的版本号读取到配置文件并打印到日志中。 第一步: 在pom.xml 中添加以下标签。    第二步: 将version 标签的值读取到配置文件中 这里使用 @@ 而不是 ${} 是因为spring boot 无法识别配置文件中的 ${} 符号会导致报错。 第三步: 如果是在spring boot 默认配置文件中配置,那么就直接在项目中用 @Value 注解注入值即可。   如果是自定义的配置文件,那么就使用 @PropertySource("classpath:fixed-config.properties") 注解来将加载自定义配置文件,然后使用 @Value 注解注入值即可 来源: https://www.cnblogs.com/qiaoyutao/p/11541577.html

How do I debug a slow rails app boot time?

不羁岁月 提交于 2019-11-30 00:06:22
Our rails app is nice and fast once it is loaded but the startup is brutally slow. Console, passenger etc all take almost 10 seconds to kick in. Seems to be way more than it should be. What tools or methods should I use to hone in on the slowest parts? What are the usual suspects? I know this is an old question but I recently had an issue with load times and this is my fork of gem which helped me find which gems were the slowest, the good thing about this gem is that loads up with the rails console, and all the initializers are run. https://github.com/mark-ellul/Bumbler 来源: https:/