ndlli 发表于 2019-2-20 07:08:48

『高级篇』docker之开发用户服务EdgeService(13)

  >原创文章,欢迎转载。转载请注明:转载自IT人故事会,谢谢!
>原文链接地址:『高级篇』docker之开发用户服务EdgeService(13)
  上一节开发了用户服务,即将开发的是用户服务EdgeService,从这个调用关系,可以看到用户的EdgeService是一个服务的服务,首选调用用户服务,对用户信息基本的操作,调用信息服务实现发送短信,发送邮件,还需要实现登录和注册的功能,并且登录是一个单点登录需要支持其他的系统,支持课程的登录的EdgeService,对他的要求是无状态的,还需要集中式的缓存redis。这么多服务集中于一身说明它是一个非常复杂的服务,不过也没关系,我们从头到尾把他开发完成。源码:https://github.com/limingios/msA-docker



新建maven模块user-edge-service



[*]引入user-thrift-service-api 和 message-thrift-service-api的pom文件




org.springframework.boot
spring-boot-starter-parent
1.5.3.RELEASE

4.0.0
com.idig8
user-edge-service
1.0-SNAPSHOT


org.springframework.boot
spring-boot-starter-web


org.apache.thrift
libthrift
0.10.0


com.idig8
user-thrift-service-api
1.0-SNAPSHOT


com.idig8
message-thrift-service-api
1.0-SNAPSHOT


org.springframework.boot
spring-boot-starter-data-redis


commons-lang
commons-lang
2.6


org.springframework.boot
spring-boot-starter-thymeleaf


org.springframework.boot
spring-boot
RELEASE
compile






[*]redis的工具类,用于无状态的存储,token信息 保存用的userInfo
RedisConfig

package com.idig8.user.redis;
  import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
  import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
  /**



  Redis缓存配置类*/
@Configurationbr/>@Value("${spring.redis.port}")br/>@Value("${spring.redis.password}")
页: [1]
查看完整版本: 『高级篇』docker之开发用户服务EdgeService(13)