boot

Eureka服务注册于发现之Client搭建

帅比萌擦擦* 提交于 2019-12-02 04:58:11
Eureka在Server端的搭建已经有很多介绍的文章,同时也是学习Eureka的第一步。 搭建好注册中心后怎么进行服务注册和服务调用,是我们要讲的主要内容。 开发环境:IDEA2018.3+SpringBoot2.1.7Release+Eureka2.1.3+SpringCloud Greenwich.SR3 第一步: Pom引入Eureka包     <!--eureka--> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> 同时需要引入 spring-cloud-dependencies,来管理SpringCloud全家桶组件 <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope

Determine if phone has been rebooted

烈酒焚心 提交于 2019-12-02 04:56:18
问题 I'm trying to detect if an Android device has rebooted since the last time a preference value is set. Ideally, I'd like to do it without the android.permission.RECEIVE_BOOT_COMPLETED permission. One way I'm thinking about doing this is storing another preference value that contains some sort of session ID. When I update the preference value in question, I'd update the session value as well. When I check the value in the preference for the session value, if it equals the current session value

Spring Boot 2.2.0,性能提升+支持Java13

自闭症网瘾萝莉.ら 提交于 2019-12-02 04:30:24
随着 Spring Framework 5.2.0 成功发布之后,Spring Boot 2.2 也紧跟其后,发布了第一个版本:2.2.0。下面就来一起来看看这个版本都更新了些什么值得我们关注的内容。 组件版本更新 这些Spring框架组件更新了依赖版本: Spring AMQP 2.2 Spring Batch 4.2 Spring Data Moore Spring Framework 5.2 Spring HATEOAS 1.0 Spring Integration 5.2 Spring Kafka 2.3 Spring Security 5.2 Spring Session Corn 框架中涉及的第三方包也更新了依赖版本: Elasticsearch 6.7 Flyway 6.0 Jackson 2.10 JUnit 5.5 Micrometer 1.3 Reactor Dysprosium Solr 8.0 大幅的性能提升 关于Spring Boot的性能问题是我们经常在内容平台上看到吐槽的关键词。这次在Spring Boot 2.2中,针对性能这一点,做了大幅的优化。应用程序的启动速度将变得更快,内存占用也会变得更少。 同时,为了加快应用的启动,还增加一个全局延迟初始化的配置参数 spring.main.lazy-initialization

BOOT_COMPLETED never received

拥有回忆 提交于 2019-12-02 04:06:40
问题 Does every device send the BOOT_COMPLETED? I want to start an Activity on Boot Completed. I put the following in the Manifest: <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <receiver android:name=".BootFinished"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> Created the following class (receiver): import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent;

Spring Boot入门样例-001-Java和Maven安装配置

你离开我真会死。 提交于 2019-12-02 03:12:35
Spring Boot入门样例-001-Java和Maven安装配置 本文说明Java和Maven在windows下的安装和配置 前言 本Spring Boot入门样例准备工作参考: Spring Boot入门样例-001-Java和Maven安装配置 Spring Boot入门样例-003-idea 安装配置和插件 Spring Boot入门样例-005-如何运行 1. 下载 下载地址: https://www.oracle.com/technetwork/java/javase/downloads/index.html 目前最新的为Java SE 13,本系列我们下载常用的Java SE 8,下载后按照指示一步步安装。 2.配置环境变量 我的电脑点击右键,然后选择属性 新建JAVA_HOME环境变量配置为JDK安装目录 新建CLASSPATH配置为.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; 在PATH环境变量中追加JAVA路径 测试JAVA安装 在命令行下执行java -version C:\Users\i>java -version java version "1.8.0_152" Java(TM) SE Runtime Environment (build 1.8.0_152-b11) Java HotSpot

在eclipse中使用maven构建spring cloud微服务

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 02:30:31
工具/原料 eclipse maven spring boot spring cloud 1.新建一个maven项目 2.文件-》新建-》项目 3.选择Maven project,然后点击下一步 4.再点击下一步 5.选择maven-archetype-quicktype 6.输入group id, artifact id等信息,点击完成 7.项目结构如图 8.在pom文件中增加spring cloud配置: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.gwolf</groupId> <artifactId>mircoclouds</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>mircoclouds</name>

Spring Boot2 系列教程(十三)Spring Boot 中的全局异常处理

不打扰是莪最后的温柔 提交于 2019-12-02 02:29:10
摘自: https://www.cnblogs.com/lenve/p/11702806.html Spring Boot2 系列教程(十三)Spring Boot 中的全局异常处理 在 Spring Boot 项目中 ,异常统一处理,可以使用 Spring 中 @ControllerAdvice 来统一处理,也可以自己来定义异常处理方案。Spring Boot 中,对异常的处理有一些默认的策略,我们分别来看。 默认情况下,Spring Boot 中的异常页面 是这样的: 我们从这个异常提示中,也能看出来,之所以用户看到这个页面,是因为开发者没有明确提供一个 /error 路径,如果开发者提供了 /error 路径 ,这个页面就不会展示出来,不过在 Spring Boot 中,提供 /error 路径实际上是下下策,Spring Boot 本身在处理异常时,也是当所有条件都不满足时,才会去找 /error 路径。那么我们就先来看看,在 Spring Boot 中,如何自定义 error 页面,整体上来说,可以分为两种,一种是静态页面,另一种是动态页面。 静态异常页面 自定义静态异常页面,又分为两种,第一种 是使用 HTTP 响应码来命名页面,例如 404.html、405.html、500.html ....,另一种就是直接定义一个 4xx.html,表示400-499

spring boot中测试时Cannot load driver class: com.mysql.cj.jdbc.Driver

爱⌒轻易说出口 提交于 2019-12-02 02:26:39
初学spring boot,第一次使用jdbc访问数据库。值得一提的是,springboot支持了主流的ORM框架,mybatis,hibernate,Spring JDBC.学习java一年来,第一次见过这个Spring JDBC。不知道这也是主流的ORM框架,学习spring boot看到了,就试用了一下。感觉应该是jdbc简单封装了下。封装力度可能比mybatis,hibernate小。不知道为啥用的少。 不过根据教程上写的配置完application.properties后,发现测试时经常报错。最后锁定一个错误:Cannot load driver class: com.mysql.cj.jdbc.Driver。感觉是数据没有连接上。但是又不知道问题出在哪儿了。上网搜了好久。才找到有大神发的springboot整合出现问题的教程。问题还是出在这个com.mysql.cj.jdbc.Driver引擎上。然后查了下具体原因。找到一篇大神的博文。 传送门: https://www.cnblogs.com/qubo520/p/8483595.html 大致原因是mysql引用的mysql-connector-java 的jar包版本问题。因为com.mysql.cj.jdbc.Driver的引擎是在mysql-connector-java 6以上版本才改的。5以下版本还是com

Determine if phone has been rebooted

梦想的初衷 提交于 2019-12-02 02:17:11
I'm trying to detect if an Android device has rebooted since the last time a preference value is set. Ideally, I'd like to do it without the android.permission.RECEIVE_BOOT_COMPLETED permission. One way I'm thinking about doing this is storing another preference value that contains some sort of session ID. When I update the preference value in question, I'd update the session value as well. When I check the value in the preference for the session value, if it equals the current session value then there has not been a reboot. If the current session value is different than what's saved, then