spring boot基于1.x.

一 集成redis

1.1 配置

  1. spring.redis.host = localhost
  2. spring.redis.port = 6379
  3. spring.redis.timeout = 10000
  4. spring.redis.database = 0
  5. spring.redis.pool.max-active = 100
  6. spring.redis.pool.max-wait = -1
  7. spring.redis.pool.max-idle = 8
  8. spring.redis.pool.min-idle = 0

1.2

工具类

  1. package com.test.util;
  2.  
  3. import java.util.List;
  4. import java.util.Set;
  5. import java.util.concurrent.TimeUnit;
  6.  
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
  9. import org.springframework.data.redis.core.HashOperations;
  10. import org.springframework.data.redis.core.ListOperations;
  11. import org.springframework.data.redis.core.RedisTemplate;
  12. import org.springframework.data.redis.core.SetOperations;
  13. import org.springframework.data.redis.core.ValueOperations;
  14. import org.springframework.data.redis.core.ZSetOperations;
  15. import org.springframework.stereotype.Component;
  16.  
  17. /**
  18. * @ClassName:RedisTemplateUtil
  19. * @Description: redis工具类
  20. * @author:
  21. * @date:2018-03-08 23:28:23
  22. *
  23. */
  24. @SuppressWarnings("unchecked")
  25. @Component
  26. public class RedisTemplateUtil {
  27.  
  28. @SuppressWarnings("rawtypes")
  29. @Autowired
  30. private RedisTemplate redisTemplate;
  31. /**
  32. * 写入缓存
  33. * @param key
  34. * @param value
  35. * @return
  36. */
  37. public boolean set(final String key, Object value, Integer database) {
  38. boolean result = false;
  39. try {
  40. JedisConnectionFactory jedisConnectionFactory = (JedisConnectionFactory) redisTemplate.getConnectionFactory();
  41. jedisConnectionFactory.setDatabase(database);
  42. redisTemplate.setConnectionFactory(jedisConnectionFactory);
  43.  
  44. ValueOperations<String, Object> operations = (ValueOperations<String, Object>) redisTemplate.opsForValue();
  45. operations.set(key, value);
  46. result = true;
  47. } catch (Exception e) {
  48. e.printStackTrace();
  49. }
  50. return result;
  51. }
  52. /**
  53. * 写入缓存设置时效时间
  54. * @param key
  55. * @param value
  56. * @return
  57. */
  58. public boolean set(final String key, Object value, Long expireTime, TimeUnit unit, Integer database) {
  59. boolean result = false;
  60. try {
  61. JedisConnectionFactory jedisConnectionFactory = (JedisConnectionFactory) redisTemplate.getConnectionFactory();
  62. jedisConnectionFactory.setDatabase(database);
  63. redisTemplate.setConnectionFactory(jedisConnectionFactory);
  64. ValueOperations<String, Object> operations = redisTemplate.opsForValue();
  65. operations.set(key, value, expireTime, unit);
  66. result = true;
  67. } catch (Exception e) {
  68. e.printStackTrace();
  69. }
  70. return result;
  71. }
  72. /**
  73. * 批量删除对应的value
  74. * @param keys
  75. */
  76. public void remove(Integer database, final String... keys) {
  77. for (String key : keys) {
  78. remove(database, key);
  79. }
  80. }
  81.  
  82. /**
  83. * 批量删除key
  84. * @param pattern
  85. */
  86. public void removePattern(Integer database, final String pattern) {
  87. Set<String> keys = redisTemplate.keys(pattern);
  88. if (keys.size() > 0){
  89. JedisConnectionFactory jedisConnectionFactory = (JedisConnectionFactory) redisTemplate.getConnectionFactory();
  90. jedisConnectionFactory.setDatabase(database);
  91. redisTemplate.setConnectionFactory(jedisConnectionFactory);
  92. redisTemplate.delete(keys);
  93. }
  94. }
  95. /**
  96. * 删除对应的value
  97. * @param key
  98. */
  99. public void remove(Integer database, final String key) {
  100. if (exists(database, key)) {
  101. redisTemplate.delete(key);
  102. }
  103. }
  104. /**
  105. * 判断缓存中是否有对应的value
  106. * @param key
  107. * @return
  108. */
  109. public boolean exists(Integer database, final String key) {
  110. JedisConnectionFactory jedisConnectionFactory = (JedisConnectionFactory) redisTemplate.getConnectionFactory();
  111. jedisConnectionFactory.setDatabase(database);
  112. redisTemplate.setConnectionFactory(jedisConnectionFactory);
  113. return redisTemplate.hasKey(key);
  114. }
  115. /**
  116. * 读取缓存
  117. * @param key
  118. * @return
  119. */
  120. public Object get(Integer database, final String key) {
  121. Object result = null;
  122. JedisConnectionFactory jedisConnectionFactory = (JedisConnectionFactory) redisTemplate.getConnectionFactory();
  123. jedisConnectionFactory.setDatabase(database);
  124. redisTemplate.setConnectionFactory(jedisConnectionFactory);
  125. ValueOperations<String, Object> operations = redisTemplate.opsForValue();
  126. result = operations.get(key);
  127. return result;
  128. }
  129. /**
  130. * 哈希 添加
  131. * @param key
  132. * @param hashKey
  133. * @param value
  134. */
  135. public void hmSet(String key, Object hashKey, Object value){
  136. HashOperations<String, Object, Object> hash = redisTemplate.opsForHash();
  137. hash.put(key,hashKey,value);
  138. }
  139.  
  140. /**
  141. * 哈希获取数据
  142. * @param key
  143. * @param hashKey
  144. * @return
  145. */
  146. public Object hmGet(String key, Object hashKey){
  147. HashOperations<String, Object, Object> hash = redisTemplate.opsForHash();
  148. return hash.get(key,hashKey);
  149. }
  150.  
  151. /**
  152. * 列表添加
  153. * @param k
  154. * @param v
  155. */
  156. public void lPush(String k,Object v){
  157. ListOperations<String, Object> list = redisTemplate.opsForList();
  158. list.rightPush(k,v);
  159. }
  160.  
  161. /**
  162. * 列表获取
  163. * @param k
  164. * @param l
  165. * @param l1
  166. * @return
  167. */
  168. public List<Object> lRange(String k, long l, long l1){
  169. ListOperations<String, Object> list = redisTemplate.opsForList();
  170. return list.range(k,l,l1);
  171. }
  172.  
  173. /**
  174. * 集合添加
  175. * @param key
  176. * @param value
  177. */
  178. public void add(String key,Object value){
  179. SetOperations<String, Object> set = redisTemplate.opsForSet();
  180. set.add(key,value);
  181. }
  182.  
  183. /**
  184. * 集合获取
  185. * @param key
  186. * @return
  187. */
  188. public Set<Object> setMembers(String key){
  189. SetOperations<String, Object> set = redisTemplate.opsForSet();
  190. return set.members(key);
  191. }
  192.  
  193. /**
  194. * 有序集合添加
  195. * @param key
  196. * @param value
  197. * @param scoure
  198. */
  199. public void zAdd(String key,Object value,double scoure){
  200. ZSetOperations<String, Object> zset = redisTemplate.opsForZSet();
  201. zset.add(key,value,scoure);
  202. }
  203.  
  204. /**
  205. * 有序集合获取
  206. * @param key
  207. * @param scoure
  208. * @param scoure1
  209. * @return
  210. */
  211. public Set<Object> rangeByScore(String key,double scoure,double scoure1){
  212. ZSetOperations<String, Object> zset = redisTemplate.opsForZSet();
  213. return zset.rangeByScore(key, scoure, scoure1);
  214. }
  215.  
  216. public void extentExpire(String key, Long expireTime, TimeUnit unit) {
  217. redisTemplate.boundValueOps(key).expire(expireTime, unit);
  218. }
  219. }

二 集成elasticsearch

2.1 配置

  1. elasticsearch.ip=localhost
  2. elasticsearch.port=9300
  3. elasticsearch.cluster.name=my-elasticsearch
  4. elasticsearch.pool=100
  5. elasticsearch.index=test
  6. elasticsearch.type=test

2.2

  1. package com.test.util;
  2.  
  3. import java.util.Map;
  4. import java.util.UUID;
  5.  
  6. import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
  7. import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse;
  8. import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
  9. import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse;
  10. import org.elasticsearch.action.delete.DeleteResponse;
  11. import org.elasticsearch.action.get.GetRequestBuilder;
  12. import org.elasticsearch.action.get.GetResponse;
  13. import org.elasticsearch.action.index.IndexResponse;
  14. import org.elasticsearch.action.update.UpdateRequest;
  15. import org.elasticsearch.action.update.UpdateResponse;
  16. import org.elasticsearch.client.transport.TransportClient;
  17. import org.slf4j.Logger;
  18. import org.slf4j.LoggerFactory;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.stereotype.Component;
  21.  
  22. import com.alibaba.fastjson.JSONObject;
  23.  
  24. /**
  25. * ES的操作数据类
  26. *
  27. * 备注:对es的一些操作做了一些封装,抽出来一些操作,就是传统的dao层,数据服务
  28. *
  29. *
  30. *
  31. */
  32. @Component
  33. public class ESRepository {
  34.  
  35. private static final Logger log = LoggerFactory.getLogger(ESRepository.class);
  36.  
  37. @Autowired
  38. private TransportClient client;
  39.  
  40. /**
  41. * 创建索引
  42. *
  43. * @param index
  44. * @return
  45. */
  46. public boolean buildIndex(String index) {
  47. if (!isIndexExist(index)) {
  48. log.info("Index is not exits!");
  49. }
  50. CreateIndexResponse buildIndexresponse = client.admin().indices().prepareCreate(index).execute().actionGet();
  51. log.info(" 创建索引的标志: " + buildIndexresponse.isAcknowledged());
  52.  
  53. return buildIndexresponse.isAcknowledged();
  54. }
  55.  
  56. /**
  57. * 删除索引
  58. *
  59. * @param index
  60. * @return
  61. */
  62. public boolean deleteIndex(String index) {
  63. if (!isIndexExist(index)) {
  64. log.info(" 索引不存在 !!!!!!");
  65. }
  66. DeleteIndexResponse diResponse = client.admin().indices().prepareDelete(index).execute().actionGet();
  67. if (diResponse.isAcknowledged()) {
  68. log.info("删除索引**成功** index->>>>>>>" + index);
  69. } else {
  70. log.info("删除索引**失败** index->>>>> " + index);
  71. }
  72. return diResponse.isAcknowledged();
  73. }
  74.  
  75. /**
  76. * 查询数据
  77. * @param index 索引<----->关系型数据库
  78. * @param type 类型<----->关系型数据表
  79. * @param id 数据ID<----->id
  80. * @return
  81. */
  82. public Map<String, Object> searchDataByParam(String index, String type, String id) {
  83. if(index == null || type == null || id == null) {
  84. log.info(" 无法查询数据,缺唯一值!!!!!!! ");
  85. return null;
  86. }
  87. //来获取查询数据信息
  88. GetRequestBuilder getRequestBuilder = client.prepareGet(index, type, id);
  89. GetResponse getResponse = getRequestBuilder.execute().actionGet();
  90. //这里也有指定的时间获取返回值的信息,如有特殊需求可以
  91.  
  92. return getResponse.getSource();
  93. }
  94.  
  95. /**
  96. * 更新数据
  97. *
  98. * @param data 添加的数据类型 json格式的
  99. * @param index 索引<----->关系型数据库
  100. * @param type 类型<----->关系型数据表
  101. * @param id 数据ID<----->id
  102. * @return
  103. */
  104. public void updateDataById(JSONObject data, String index, String type, String id) {
  105. if(index == null || type == null || id == null) {
  106. log.info(" 无法更新数据,缺唯一值!!!!!!! ");
  107. return;
  108. }
  109.  
  110. //更新步骤
  111. UpdateRequest up = new UpdateRequest();
  112. up.index(index).type(type).id(id).doc(data);
  113.  
  114. //获取响应信息
  115. //.actionGet(timeoutMillis),也可以用这个方法,当过了一定的时间还没得到返回值的时候,就自动返回。
  116. UpdateResponse response = client.update(up).actionGet();
  117. log.info("更新数据状态信息,status{}", response.status().getStatus());
  118. }
  119.  
  120. /**
  121. * 添加数据
  122. *
  123. * @param data 添加的数据类型 json格式的
  124. * @param index 索引<----->关系型数据库
  125. * @param type 类型<----->关系型数据表
  126. * @param id 数据ID<----->id
  127. * @return
  128. */
  129. public String addTargetDataALL(String data, String index, String type, String id) {
  130. //判断一下次id是否为空,为空的话就设置一个id
  131. if(id == null) {
  132. id = UUID.randomUUID().toString();
  133. }
  134. //正式添加数据进去
  135. IndexResponse response = client.prepareIndex(index, type, id).setSource(data).get();
  136.  
  137. log.info("addTargetDataALL 添加数据的状态:{}", response.status().getStatus());
  138.  
  139. return response.getId();
  140. }
  141.  
  142. /**
  143. * 通过ID删除数据
  144. *
  145. * @param index 索引,类似数据库
  146. * @param type 类型,类似表
  147. * @param id 数据ID
  148. */
  149. public void delDataById(String index, String type, String id) {
  150.  
  151. if(index == null || type == null || id == null) {
  152. log.info(" 无法删除数据,缺唯一值!!!!!!! ");
  153. return;
  154. }
  155. //开始删除数据
  156. DeleteResponse response = client.prepareDelete(index, type, id).execute().actionGet();
  157.  
  158. log.info("删除数据状态,status-->>>>{},", response.status().getStatus());
  159. }
  160.  
  161. /**
  162. * 判断索引是否存在
  163. *
  164. * @param index
  165. * @return
  166. */
  167. public boolean isIndexExist(String index) {
  168. IndicesExistsResponse iep = client.admin().indices().exists(new IndicesExistsRequest(index)).actionGet();
  169. if (iep.isExists()) {
  170. log.info("此索引 [" + index + "] 已经在ES集群里存在");
  171. } else {
  172. log.info(" 没有此索引 [" + index + "] ");
  173. }
  174. return iep.isExists();
  175. }
  176.  
  177. }

三 集成fastdfs

3.1

配置

  1. fastdfs.minPoolSize=10
  2. fastdfs.maxPoolSize=30
  3. fastdfs.waitTimes=200
  4.  
  5. connect_timeout = 2
  6. network_timeout = 30
  7. charset = UTF-8
  8. http.tracker_http_port = 8180
  9. tracker_server = 10.20.8.252:22122

3.2

工具类

  1. package com.test.comm;
  2.  
  3. import java.util.concurrent.LinkedBlockingQueue;
  4. import java.util.concurrent.TimeUnit;
  5.  
  6. import org.csource.fastdfs.ClientGlobal;
  7. import org.csource.fastdfs.StorageClient1;
  8. import org.csource.fastdfs.StorageServer;
  9. import org.csource.fastdfs.TrackerServer;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.springframework.beans.factory.annotation.Value;
  13. import org.springframework.stereotype.Component;
  14.  
  15. /**
  16. * Title:ConnectionPool Copyright:Copyright(c)2018 Company:test
  17. *
  18. * @author
  19. * @date 2018年9月18日 下午3:15:50
  20. */
  21. @Component
  22. public class ConnectionPool {
  23.  
  24. private final static Logger logger = LoggerFactory.getLogger(ConnectionPool.class);
  25.  
  26. /** 空闲的连接池 */
  27. private LinkedBlockingQueue<StorageClient1> idleConnectionPool = new LinkedBlockingQueue<StorageClient1>();
  28.  
  29. /** 连接池默认最小连接数 */
  30. @Value("${fastdfs.minPoolSize}")
  31. private long minPoolSize;
  32.  
  33. /** 连接池默认最大连接数 */
  34. @Value("${fastdfs.maxPoolSize}")
  35. private long maxPoolSize;
  36.  
  37. /** 默认等待时间(单位:秒) */
  38. @Value("${fastdfs.waitTimes}")
  39. private long waitTimes;
  40.  
  41. @Value("${spring.profiles.active}")
  42. private String profile;
  43.  
  44. /**
  45. * @Description: 创建TrackerServer,并放入空闲连接池
  46. */
  47. public void createTrackerServer() {
  48. logger.debug("[创建TrackerServer(createTrackerServer)]");
  49. TrackerServer trackerServer = null;
  50. try {
  51. initClientGlobal();
  52. for (int i = 0; i < minPoolSize; i++) {
  53. // 把client1添加到连接池
  54. StorageServer storageServer = null;
  55. StorageClient1 client1 = new StorageClient1(trackerServer, storageServer);
  56. idleConnectionPool.add(client1);
  57. }
  58. } catch (Exception e) {
  59. logger.error("[创建TrackerServer(createTrackerServer)][异常:{}]", e);
  60. }
  61. }
  62.  
  63. /**
  64. * @Description: 获取空闲连接 1).在空闲池(idleConnectionPool)中弹出一个连接;
  65. * 2).把该连接放入忙碌池(busyConnectionPool)中; 3).返回 connection
  66. * 4).如果没有idle connection, 等待 wait_time秒, and check again
  67. * @throws AppException
  68. */
  69. public StorageClient1 checkout() {
  70. StorageClient1 client1 = idleConnectionPool.poll();
  71. if (client1 == null) {
  72. if (idleConnectionPool.size() < maxPoolSize) {
  73. createTrackerServer();
  74. try {
  75. client1 = idleConnectionPool.poll(waitTimes, TimeUnit.SECONDS);
  76. } catch (Exception e) {
  77. logger.error("[获取空闲连接(checkout)-error][error:获取连接超时:{}]", e);
  78. }
  79. }
  80. }
  81.  
  82. // 添加到忙碌连接池
  83. // busyConnectionPool.put(client1, obj);
  84. logger.debug("[获取空闲连接(checkout)][获取空闲连接成功]");
  85. return client1;
  86. }
  87.  
  88. /**
  89. * @Description: 释放繁忙连接 1.如果空闲池的连接小于最小连接值,就把当前连接放入idleConnectionPool;
  90. * 2.如果空闲池的连接等于或大于最小连接值,就把当前释放连接丢弃;
  91. * @param client1
  92. * 需释放的连接对象
  93. */
  94. public void checkin(StorageClient1 client1) {
  95. logger.debug("[释放当前连接(checkin)]");
  96. client1 = null;
  97. if (idleConnectionPool.size() < minPoolSize) {
  98. createTrackerServer();
  99. }
  100. }
  101.  
  102. private void initClientGlobal() throws Exception {
  103. String FASTDFS_CONFIG = "application-" + profile + ".properties";
  104. ClientGlobal.init(FASTDFS_CONFIG);
  105. }
  106.  
  107. public LinkedBlockingQueue<StorageClient1> getIdleConnectionPool() {
  108. return idleConnectionPool;
  109. }
  110.  
  111. public long getMinPoolSize() {
  112. return minPoolSize;
  113. }
  114.  
  115. public void setMinPoolSize(long minPoolSize) {
  116. if (minPoolSize != 0) {
  117. this.minPoolSize = minPoolSize;
  118. }
  119. }
  120.  
  121. public long getMaxPoolSize() {
  122. return maxPoolSize;
  123. }
  124.  
  125. public void setMaxPoolSize(long maxPoolSize) {
  126. if (maxPoolSize != 0) {
  127. this.maxPoolSize = maxPoolSize;
  128. }
  129. }
  130.  
  131. public long getWaitTimes() {
  132. return waitTimes;
  133. }
  134.  
  135. public void setWaitTimes(int waitTimes) {
  136. if (waitTimes != 0) {
  137. this.waitTimes = waitTimes;
  138. }
  139. }
  140. }

四 集成rabbitmq

4.1 配置

  1. spring.rabbitmq.host=localhost
  2. spring.rabbitmq.port=5672
  3. spring.rabbitmq.username=admin
  4. spring.rabbitmq.password=12345678
  5. spring.rabbitmq.publisher-confirms=true
  6. spring.rabbitmq.virtual-host=/

4.2

  1. package com.test.rabbitmq;
  2.  
  3. import org.springframework.amqp.core.Binding;
  4. import org.springframework.amqp.core.BindingBuilder;
  5. import org.springframework.amqp.core.Queue;
  6. import org.springframework.amqp.core.TopicExchange;
  7. import org.springframework.context.annotation.Bean;
  8.  
  9. /**
  10. * 在这里新建一个队列,并将队列与交换机绑定
  11. *
  12. * <p>
  13. * Title:Application
  14. * </p>
  15. * <p>
  16. * Description:TODO
  17. * </p>
  18. * <p>
  19. * Copyright:Copyright(c)2005
  20. * </p>
  21. * <p>
  22. * Company:test
  23. * </p>
  24. *
  25. * @author
  26. * @date 2018年9月12日 上午9:40:48
  27. */
  28. public class Application {
  29.  
  30. /**
  31. * 新建队列
  32. */
  33.  
  34. @Bean
  35. public Queue queuePush() {
  36. return new Queue("sy-admin-push");
  37. }
  38.  
  39. /**
  40. * 创建交换机
  41. */
  42. @Bean
  43. TopicExchange exchange() {
  44. return new TopicExchange("sy-exchange-admin");
  45. }
  46.  
  47. /**
  48. * 绑定交换机
  49. */
  50.  
  51. /**
  52. * 将队列topic.message与exchange绑定,binding_key为topic.message,就是完全匹配
  53. * @param queueMessage
  54. * @param exchange
  55. * @return
  56. */
  57. @Bean
  58. Binding bindingExchangeMessage(Queue queueMessage, TopicExchange exchange) {
  59. return BindingBuilder.bind(queueMessage).to(exchange).with("topic.message");
  60. }
  61.  
  62. @Bean
  63. public void binding () {
  64. Queue queue = queuePush();
  65. TopicExchange exchange = exchange();
  66. bindingExchangeMessage(queue, exchange);
  67. }
  68. }

模拟消费者

  1. package com.test.rabbitmq;
  2.  
  3. import org.slf4j.Logger;
  4. import org.slf4j.LoggerFactory;
  5. import org.springframework.amqp.rabbit.annotation.RabbitHandler;
  6. import org.springframework.amqp.rabbit.annotation.RabbitListener;
  7. import org.springframework.stereotype.Component;
  8.  
  9. import com.test.util.AESUtils;
  10.  
  11. @Component
  12. @RabbitListener(queues = "test")
  13. public class Consumer {
  14.  
  15. private final static Logger logger = LoggerFactory.getLogger(Consumer.class);
  16.  
  17. @RabbitHandler
  18. public void process(String message) {
  19. logger.debug("模拟移动端接收到一条推送消息" + message);
  20. logger.debug("解密后的消息 " + AESUtils.decryptData(message));
  21. }
  22.  
  23. }

模拟生产者

  1. package com.test.rabbitmq;
  2.  
  3. import org.slf4j.Logger;
  4. import org.slf4j.LoggerFactory;
  5. import org.springframework.amqp.rabbit.core.RabbitTemplate;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Component;
  8.  
  9. import com.test.util.AESUtils;
  10.  
  11. @Component
  12. public class Producer {
  13.  
  14. private final static Logger logger = LoggerFactory.getLogger(Producer.class);
  15.  
  16. @Autowired
  17. private RabbitTemplate rabbitTemplate;
  18.  
  19. public void producer (final String queue, final String message) {
  20. new Thread(new Runnable() {
  21.  
  22. @Override
  23. public void run() {
  24. logger.debug("接收到一条消息" + message);
  25. //加密
  26. String newMessage = AESUtils.encryptData(message);
  27. logger.debug("加密后的消息为 " + newMessage);
  28. rabbitTemplate.convertSendAndReceive(queue, newMessage);
  29. logger.debug("向移动端推送消息" + newMessage);
  30.  
  31. }
  32. }).start();
  33.  
  34. }
  35.  
  36. }

spring boot 常见的第三方集成的更多相关文章

  1. Spring Boot微服务如何集成fescar解决分布式事务问题?

    什么是fescar? 关于fescar的详细介绍,请参阅fescar wiki. 传统的2PC提交协议,会持有一个全局性的锁,所有局部事务预提交成功后一起提交,或有一个局部事务预提交失败后一起回滚,最 ...

  2. Spring Boot 2.0 快速集成整合消息中间件 Kafka

    欢迎关注个人微信公众号: 小哈学Java, 每日推送 Java 领域干货文章,关注即免费无套路附送 100G 海量学习.面试资源哟!! 个人网站: https://www.exception.site ...

  3. Spring Boot与ActiveMQ的集成

    Spring Boot对JMS(Java Message Service,Java消息服务)也提供了自动配置的支持,其主要支持的JMS实现有ActiveMQ.Artemis等.本节中,将以Active ...

  4. spring boot与ElasticSearch的集成

    本文主要介绍Spring boot与ElasticSearch的集成,因为Spring boot的教程以及ElasticSearch的学习其他博客可能更优秀,所以建议再看这篇文章前先学习学习一下Spr ...

  5. Spring Boot 微服务应用集成Prometheus + Grafana 实现监控告警

    Spring Boot 微服务应用集成Prometheus + Grafana 实现监控告警 一.添加依赖 1.1 Actuator 的 /prometheus端点 二.Prometheus 配置 部 ...

  6. Spring Boot 2.x 快速集成Kafka

    1 Kafka Kafka是一个开源分布式的流处理平台,一种高吞吐量的分布式发布订阅消息系统,它可以处理消费者在网站中的所有动作流数据.Kafka由Scala和Java编写,2012年成为Apache ...

  7. Spring Boot(八)集成Spring Cache 和 Redis

    在Spring Boot中添加spring-boot-starter-data-redis依赖: <dependency> <groupId>org.springframewo ...

  8. Spring Boot(六)集成 MyBatis 操作 MySQL 8

    一.简介 1.1 MyBatis介绍 MyBatis 是一款优秀的持久层框架,它支持定制化 SQL.存储过程以及高级映射.MyBatis 避免了几乎所有的 JDBC代码和手动设置参数以及获取结果集. ...

  9. Spring Boot (二)集成Jsp与生产环境部署

    一.简介 提起Java不得不说的一个开发场景就是Web开发,也是Java最热门的开发场景之一,说到Web开发绕不开的一个技术就是JSP,因为目前市面上仍有很多的公司在使用JSP,所以本文就来介绍一下S ...

随机推荐

  1. ES - Index Templates 全局index模板

    1.Index Templates 之前我们聊过Dynamic template,它作用范围是特定的Index,如果我们想针对全局Index进行设置该如何操作呢? Index Templates 可以 ...

  2. 你云我云•兄弟夜谈会 第三季 企业IT架构

    你云我云•兄弟夜谈会 第三季 企业IT架构 你云我云•兄弟夜谈会 第二季 5G 你云我云•兄弟夜谈会 第一季 企业云 0. 概况 时间:2019年2月23日 22:00~23:30 主题:企业IT架构 ...

  3. 事务回滚 SET XACT_ABORT ON

    USE tempdb IF OBJECT_ID ('dbo.test') IS NOT NULL DROP TABLE dbo.test GO CREATE TABLE dbo.test ( id I ...

  4. C# 反射,动态类,动态方法

    1.动态类名,固定方法名,例如.调用不同类下边的GetById()方法: //项目需要引用Miscorsoft.CSharp类库,否则会报错:找不到编译动态表达式所需的一个或者多个类型.//引用这两个 ...

  5. leetCode104. 二叉树的最大深度

    给定一个二叉树,找出其最大深度. 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数. 说明: 叶子节点是指没有子节点的节点. 示例:给定二叉树 [3,9,20,null,null,15,7], ...

  6. Ubuntu离线安装docker

    1.先安装依赖libltdl7_2.4.6-0.1_amd64.deb 下载链接http://archive.ubuntu.com/ubuntu/pool/main/libt/libtool/libl ...

  7. make apr-util 报错 all recurisive

    安装expat库: yum install expat-devel 再次make 即可.

  8. 电脑修改密码后git上传失败Authentication failed

    (一)进入控制面板 (二)选择用户账户 (三)选择管理你的凭据 (四)选择Windows凭据 (五)选择git保存的用户信息 (六)选择编辑或者进行删除操作 (七)完成

  9. sqlserver 存储过程 自定义函数 游标???

    create proc cur_fun( @cur cursor --输入参数 ) as begin declare @mytpye tb1_type ) fetch next from @cur i ...

  10. Android中四大组件总结

    android四大组件分别为activity.service.content provider.broadcast receiver. 一.android四大组件详解 1.activity (1)一个 ...