boot

spring boot 实战 / 可执行war启动参数详解

Deadly 提交于 2020-01-08 19:23:57
概述   上一篇文章 《spring boot 实战 / mvn spring-boot:run 参数详解》 主要讲解了spring boot 项目基于maven插件启动过程中借助profiles的切换工作环境的问题。   这里我们讲一下spring boot项目基于可执行war包启动过程中借助profiles切换工作环境的问题。 配置   这里我们修改文章 《spring boot 实战 / mvn spring-boot:run 参数详解》 中提到的文件pom.xml。 1、修改打包packaging标签为war。 2、往其中添加如下依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> 修改后的文件内容如下如示: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=

SpringApplication认识

怎甘沉沦 提交于 2020-01-08 13:44:24
SpringApplication SpringApplication Spring Boot 驱动Spring应用上下文的引导类 @SpringBootConfiguration @EnableAutoConfiguration @ComponentScan( excludeFilters = {@Filter( type = FilterType.CUSTOM, classes = {TypeExcludeFilter.class} ), @Filter( type = FilterType.CUSTOM, classes = {AutoConfigurationExcludeFilter.class} )} ) public @interface SpringBootApplication { ......... } @ComponentScan是Spring FrameWork3.1版本开始引入的 @EnableAutoConfiguration:激活自动装配 @Enable->@Enable开头的(Enable开头的取个名字叫激活模式) @EnableWebMvc @EnableTransactionManagement @EnableAspectJAutoProxy @EnableAsync @SpringBootConfiguration:等价于

springmvc和springboot的差别

跟風遠走 提交于 2020-01-08 09:10:04
  springmvc默认的前端代码和资源webapp中,而springboot默认在static,public等,那么还有什么显著差别吗?   spring的配置:spring.application.name: article (spring boot下无效) spring boot的配置:server.servlet.context-path: /article 参考博文: https://blog.csdn.net/android_app_2012/article/details/100866376 来源: https://www.cnblogs.com/Robin008/p/12164720.html

spring cloud微服务快速教程之(六) 应用监控 spring boot admin

怎甘沉沦 提交于 2020-01-08 08:41:37
0-前言   当我们发布了微服务后,我们希望对各个应用的各个运行状况进行一个监控;这个时候spring boot admin,就出场了;    spring boot admin:是一个监控和管理spring boot 应用的开源监控组件, 它能够对Actuator 中的信息进行界面化的展示,也可以监控所有 Spring Boot 应用的健康状况,提供实时警报功能。 一、集成spring boot admin 1、创建server端: 1.1、创建monitor模块,添加依赖: <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server</artifactId> <version>2.0.5</version></dependency><dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-server-ui</artifactId> <version>2.0.5</version></dependency> 1.2、启动类增加 @EnableAdminServer 注解 @SpringBootApplication @EnableEurekaClient

SpringBoot起步依赖和自动配置

空扰寡人 提交于 2020-01-08 05:42:40
一、起步依赖 1. 是什么 本质上是一个Maven项目对象模型(Project Object Model, POM), 定义了对其他库的传递依赖,这些东西加在一起即支持某项功能。 比如: spring-boot-dependencies ^ spring-boot-parent ^ spring-boot-starters ^ spring-boot-starter-web spring boot起步依赖的名字具有很大的可读性,一般见到名字就知道其功能。 使用起步依赖 = 起步依赖+依赖的传递依赖(注意:这些依赖的版本是确定好了的, 经过实践验证的可用的,自己不需要再添加), 可以通过 $ mvn dependency:tree 查看依赖树。 2. 怎么用 <!--添加web起步依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <!--排除不需要的传递依赖--> <exclusions> <exclusion> <groupId>com.fasterxml.jackson.core</groupId> </exclusion> </exclusions> </dependency> <!--如果想加其他依赖

Spring Boot Actuator未授权访问

岁酱吖の 提交于 2020-01-07 23:37:58
当我们发现某一个网页的logo是一篇叶子或者报错信息如下图所示的话,就可以尝试Spring Boot Actuator未授权访问。 /dump - 显示线程转储(包括堆栈跟踪) /autoconfig - 显示自动配置报告 /configprops - 显示配置属性 /trace - 显示最后几条HTTP消息(可能包含会话标识符) /logfile - 输出日志文件的内容 /shutdown - 关闭应用程序 /info - 显示应用信息 /metrics - 显示当前应用的’指标’信息 /health - 显示应用程序的健康指标 /beans - 显示Spring Beans的完整列表 /mappings - 显示所有MVC控制器映射 /env - 提供对配置环境的访问 /restart - 重新启动应用程序/jolokia/list - 存在logback组件,可执行远程代码 Spring Boot Actuator未授权访问 来源: https://www.cnblogs.com/endust/p/12164277.html

Spring boot 缓存的使用

半腔热情 提交于 2020-01-07 13:05:04
1 首先 引入配置: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-cache</artifactId> </dependency>    2 然后开始 缓存的使用   启动类上加上 注解:@EnableCaching 3 在你要使用的 缓存的 方法上面加上 @Cacheable(value = "缓存的名字",key = "#p1")     备注 key="#p1" ,表示用参数p1 做 缓存的唯一标志 关于 2 中 缓存 ehche 和 redis 1 如果只是简单的需要一个缓存,不需要 多节共享,不需要对持久换有要求,那么使用ehcahe 之类的 Java嵌入式的缓存 是和合适的。 2 如果需要多节点 共享 ,对数据的格式,持久换要求比较高。那么可以选着 redis 之类的 独立运行的 缓存 工具。 redis 配置: 配置redis 并且制定缓存是 redis( 备注,redis做缓存 @Cacheable 里面必须指定缓存的 名字,ehcache 因为配置文件指定了 默认缓存,所以可以不指定 ) 备注1: 可以指定 过期时间,但是这是毫秒数 备注2:可以指定统一的 缓存 前缀,但是这样 @Cacheable 里面 指定的 缓存名就无效了

J360-cloud SpringCloud系列二:服务发现Discovery Service

喜欢而已 提交于 2020-01-07 07:36:02
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> j360开源博客之 ---------------------------------------------------------- J360-Cloud系列 spring-cloud快速入门工程之j360-cloud-all:( 欢迎star、fork ) https://github.com/xuminwlt/j360-cloud-all spring cloud系列博客 (oschina首页推荐)J360-cloud SpringCloud系列一:分布式配置服务器ConfigServer 服务发现Discovery Service Discovery Service 是另一个重要的微服务架构的组件.Discovery Service管理运行在容器中的众多服务实例,而这些实例工作在集群环境下.在这些应用中,我们使用客户端的方式称之为从服务到服务 discovery service细分为3个部分: EurekaServer 服务注册服务器 EurekaService 服务提供方,服务启动时会向注册服务器server注册该服务,服务通过rest形式提供api接口 EurekaClient 服务客户端,通过restTemplate、Feign完成调用 Feign声明式 REST Client Spring

Copy a shell script to android out folder and execute it during boot

痴心易碎 提交于 2020-01-07 05:08:27
问题 I have a shell script which I need to copy to anywhere in out folder during Android build process so that it appears somewhere in Android RootFS. Now, once it is copied after Android build process and becomes part of Android RootFS, I want to execute the shell script during boot time. How can I do it? 回答1: Well, I created a root folder in AOSP or anywhere, then created Android.mk and copied the script to be copied to out folder. Added below comments in Android.mk $(shell cp -rf $(LOCAL_PATH)

精选Spring Boot 优质GitHub开源项目!

纵然是瞬间 提交于 2020-01-07 01:49:16
Spring Boot 算是目前 Java 领域最火的技术栈了,也是Java开发人员不得不掌握的技术,今天给大家整理了13个优质 Spring Boot 开源项目给大家参考,希望能够帮助到正在学习 Spring Boot 的小伙伴!小伙伴简历中不知道写什么项目的或者项目没有亮点的,我只能帮你们到这了!下边的项目排名不分先后! 一、 mall https://github.com/macrozheng/mall mall项目是一套电商系统,包括前台商城系统及后台管理系统,基于SpringBoot+MyBatis实现。前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。 二、 Cloud-Platform https://gitee.com/geek_qi/cloud-platform Cloud-Platform是国内首个基于Spring Cloud微服务化开发平台,具有统一授权、认证后台管理系统,其中包含具备用户管理、资源权限管理、网关API 管理等多个模块,支持多业务系统并行开发,可以作为后端服务的开发脚手架。代码简洁,架构清晰,适合学习和直接项目中使用。核心技术采用Spring Boot 2.1