ITeye博客

Spring Framework

共 9 篇文章

搭建consul单机和集群基础配置

单机 docker获取consul并创建容器的步骤 docker pull consul docker run --name consul -d -p 8500:8500 -p 8600:8600/udp consul 集群 建立consul集群命令步骤 建立第一个容器,并启动第一个consul服务 # docker run --name consul1 -d -p 8500:8500 -p 8300:8300 -p 8301:8301 -p 8302:8302 -p 8600:8600 consul agent -server -bootstrap-expect 2 -ui -bind=0…

2020-01-04 00:27 · Java 技术 · Spring Framework · Spring boot

关于spring-boot-maven-plugin插件打包外部依赖jar

在开发Springboot应用时经常会采用如下MAVEN方式引用并不受MAVEN仓库管理的JAR com.microsoft.sqlserver sqljdbc41 4.1 system ${basedir}/lib/sqljdbc41.jar 但在打包Springboot应用时,默认情况下并不会将该JAR打包进去,虽然MAVEN提供很多可以将该JAR打包进去的工具,像JAR,ASSEMBLY工具在copy阶段拷贝外部JAR。但是Spring为我们提供了更简单的方式,通过spring-boot-maven-plugin插件的配置项includeSystemScope很快就可以完成此功能,如下…

2019-12-06 10:21 · maven · Spring Framework · Spring boot

记录使用Spring OAuth2RestTemplate 遇到的坑

最近工作的一个项目中需要调用第三方提供的API获取数据,该API接口采用的授权方式是OAuth2,授权类型采用client_crdentials。鉴于Spring框架完善的生态系统我们直接采用了spring-security-oauth2 框架中提供的OAuth2客户端能力。现将使用框架过程中遇到的几个问题记录,供以后参考,以希望其他开发的同学能够避免踩坑。 (1)[b]关于security.oauth2.client.*几个相关配置项容易混淆[/b] [list] [*] .[b]security.oauth2.client.authentication-scheme[/b] 这个配置项主…

2019-11-28 20:59 · Spring Framework · oauth2

Spring 框架笔记—4.16.2 标准与自定义事件

[size=medium][b] Spring 框架笔记—4.16.2 标准与自定义事件[/b][/size] Event handling in the [b]ApplicationContext[/b] is provided through the [b]ApplicationEvent[/b] class and [b]ApplicationListener[/b] interface. If a bean that implements the [b]ApplicationListener[/b] interface is deployed into the context, ev…

2019-08-31 00:02 · Spring Framework · Spring boot

高级话题—Exception Handling in Spring MVC

[size=large][b] 高级话题之—Exception Handling in Spring MVC[/b][/size] Spring MVC provides several complimentary approaches to exception handling but, when teaching Spring MVC, I often find that my students are confused or not comfortable with them. 【Spring MVC 提供了几种免费的异常处理方式,但在我教授Spring MVC时,我发现我的学生往往对…

2019-08-12 10:21 · Spring Framework

Spring boot 参考手册——第31章缓存阅读笔记和注意点

[b][size=medium]Spring boot 参考手册——第31章缓存阅读笔记和注意点[/size][/b] 基于Spring boot 1.5.19.RELEASE版本 码字不易,转载请注明出处 [b]一、阅读笔记[/b] 1. Spring boot 只是在Spring框架提供的缓存抽象能力之上为我们做了一些自动配置的工作, 本质上Spring框架也并不提供缓存存储能力,只是提供了核心的抽像层接口Cache和CacheManager,方便集成第三方缓存提供商。 [code="java"]Spring Boot auto-configures the cache infrastr…

2019-03-30 22:10 · Spring Framework · 缓存技术 · Spring boot

Spring boot 参考手册——第40章测试阅读笔记和注意点

Spring boot 参考手册——第40章测试功能 阅读笔记和注意点 基于Spring boot 1.3.8.RELEASE版本 40.3 测试Spring Boot应用 1.spring-boot-test在创建Spring boot测试所需要的ApplicationContext时和创建Spring Framework的测试所需要的ApplicationContext并无太大区别,但有一点要注意: 像外置属性、日志记录及其他Spring boot特性需要基于 SpringApplication 创建 2.spring-boot-test 提供的注解@SpringApplicationC…

2019-03-27 18:44 · Spring Framework · Spring boot · Test

Spring Boot 参考指南读书笔记-75章节数据库初始化

Spring Boot 参考指南读书笔记-75章节数据库初始化 75.2 使用Hibernate初始化数据库 配置属性 spring.jpa.hibernate.ddl-auto 的值包括: none, validate, update, create, create-drop 该属性的默认值取决于框架检测到的数据库连接类型是否为嵌入式数据库 如果为嵌入式数据库,则值为create-drop否则为none 如果你在类路径中放置了数据库初始化脚本文件 schema-${platform}.sql, schema.sql或 data-${platform}.sql,data.sql 为导致数据库…

2019-01-02 15:33 · Spring Framework

<context:property-placeholder/>元素 location属性值笔记

[size=large]前言[/size] 一般的spring框架都是用在web项目中,xml中的properties文件的配置一般都是classpath:db.properties的格式。但在非web项目中,需要将这些db.propperties文件独立放在一个conf文件夹中,那么就无法使用classpath:这种格式了。最近在部署一个项目中遇到经常会修改properties文件中配置属性的值,因此将部署包中的属性配置文件都提到一个固定目录,由于项目Spring的配置文件采用元素引用这些properties配置文件,因此对 location属性的支持的文件位置做一下记录。 [size=l…

2018-07-15 19:01 · Spring Framework