Browse Source

'继续移除shiro多余引用'

tuonina 6 years ago
parent
commit
85ce3ec152

+ 8 - 0
README.md

@@ -30,6 +30,14 @@
 - 项目包名统一为 cn.gygxzc.envir.**
 - 项目对mybatis plus进行了升级,使用的是mybatis-plus 3.0,与之前有一定区别,具体可见[文档](http://mp.baomidou.com/guide/wrapper.html#querywrapper)
 
+#### 2018/9/29
+- 添加配置中心,将配置中心与即时通信消息系统结合起来
+- 添加Spring bus。服务间的消息通知。这一点举一点应用:业务系统需要向前端或者用户发送消息,
+只需要调用发送消息的sender即可。由消息中心把消息发送给前端用户。
+
+- 删除shiro配置,但是因为授权中心使用shiro,导致客户端不能完全移除shiro依赖,但是只引用了shiro的核心包。
+具体原因是:授权中心shiro在生成的session中放入了shiro包中的类实体对象,jdk序列化之后,在各自的业务系统中反序列化,如果不引入shiro核心包,将
+导致jdk反序列化失败,导致各自业务系统无法获取到当前登录的用户信息。
 
 ### 后期计划
 

+ 12 - 3
build.gradle

@@ -94,11 +94,14 @@ subprojects {
         compile('org.springframework.cloud:spring-cloud-starter-openfeign')
         compile("org.springframework.session:spring-session-data-redis")
 //
-
-        compile('org.springframework.boot:spring-boot-starter-web')
+        compile('org.springframework.boot:spring-boot-starter-web'){
+            exclude module:'spring-boot-starter-tomcat'
+        }
+        compile('org.springframework.boot:spring-boot-starter-jdbc')
         compile('org.springframework.boot:spring-boot-starter-actuator')
-        compile('org.springframework.boot:spring-boot-starter-websocket')
+
         compile('org.springframework.boot:spring-boot-starter-jta-atomikos')
+        compile('org.springframework.boot:spring-boot-starter-jetty')
 
 //        cache
         compile('org.springframework.boot:spring-boot-starter-cache')
@@ -111,6 +114,12 @@ subprojects {
         testCompile('org.springframework.boot:spring-boot-starter-test')
         // mq
         compile('com.fasterxml.jackson.module:jackson-module-kotlin:2.9.6')
+
+        //只因用shiro核心包
+        compile("org.apache.shiro:shiro-core:$shiro_version"){
+            exclude group:"org.apache.shiro"
+        }
+
         // commons
         compile("commons-io:commons-io:$commons_io_version")
         compile("org.apache.commons:commons-lang3:$commons_lang3_version")

+ 0 - 1
cloud-bus/build.gradle

@@ -1,4 +1,3 @@
-apply plugin 'java'
 
 group 'cn.gygxzc.tina'
 version '1.0'

+ 10 - 1
cloud-bus/src/main/java/cn/gygxzc/tina/cloud/bus/messager/bean/MessageBean.java

@@ -1,11 +1,14 @@
 package cn.gygxzc.tina.cloud.bus.messager.bean;
 
+import java.io.Serializable;
+
 /**
  * Created by niantuo on 2018/9/29.
  * 消息发送的实体类
  */
 
-public class MessageBean {
+public class MessageBean implements Serializable {
+    public static final long serialVersionUID = 1L;
     private int code;
     private String message;
 
@@ -24,4 +27,10 @@ public class MessageBean {
     public void setMessage(String message) {
         this.message = message;
     }
+
+    @Override
+    public String toString() {
+        return "code: " + code + "  message: " + message;
+    }
+
 }

+ 1 - 0
zen-web/build.gradle

@@ -14,6 +14,7 @@ buildscript {
 
 dependencies {
     compile project(":zen-api")
+    compile project(':cloud-bus')
 }
 
 bootJar { enabled = true }

+ 1 - 0
zen-web/src/main/kotlin/cn/gygxzc/envir/api/rabbit/controller/RabbitMQController.kt

@@ -2,6 +2,7 @@ package cn.gygxzc.envir.api.rabbitmq.controller
 
 import cn.gygxzc.tina.cloud.bus.messager.bean.MessageBean
 import cn.gygxzc.tina.cloud.bus.messager.sender.IMessagerSender
+import cn.gygxzc.tina.cloud.jwt.session.filter.JwtSessionRepositoryFilter
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.web.bind.annotation.PostMapping
 import org.springframework.web.bind.annotation.RequestMapping

+ 0 - 34
zen-web/src/main/resources/application.yml

@@ -1,13 +1,5 @@
 
-server:
-  port: 11000
-
 spring:
-  profiles:
-    active: dev
-    include: orm,cache,msg
-  application:
-    name: framework   # 服务名称,改成自己的,名称固定不变,不要随便更改
   http:
     converters:
       preferred-json-mapper: jackson
@@ -24,28 +16,9 @@ spring:
 
 
 
-#服务注册于发现配置
-eureka:
-  instance:
-    hostname: localhost
-    prefer-ip-address: true
-    ip-address: 192.168.1.96  # 把自己的ip替换
-  client:
-    register-with-eureka: true
-    fetch-registry: true
-    service-url:
-      registry1: http://192.168.1.206:11001/eureka/
-
 ---
 spring:
   profiles: dev
-  cloud:
-    config:
-      allow-override: true
-      discovery:
-        enabled: true
-        service-id: messager
-      profile: dev
   session:
     store-type: redis
     redis:
@@ -53,13 +26,6 @@ spring:
       port: 6379
       database: 0
 
-eureka:
-  client:
-    service-url:
-      defaultZone: http://192.168.1.206:11001/eureka/
-    register-with-eureka: true
-    fetch-registry: true
-
 swagger:
   open: true
 

+ 31 - 1
zen-web/src/main/resources/bootstrap.yml

@@ -1,3 +1,7 @@
+# 服务端口号
+server:
+  port: 11000
+
 spring:
   application:
     name: framework
@@ -6,4 +10,30 @@ spring:
       profile: dev
       discovery:
         enabled: true
-        service-id: messager
+        service-id: messager
+  profiles:
+    active: dev
+    include:  orm,cache,msg
+
+
+---
+spring:
+  profiles: dev
+
+eureka:
+  instance:
+    ip-address: 192.168.1.96
+    prefer-ip-address: true
+  client:
+    service-url:
+      defaultZone: http://192.168.1.206:11001/eureka/
+
+---
+spring:
+  profiles: prod
+
+
+eureka:
+  client:
+    service-url:
+      defaultZone: http://192.168.1.206:11001/eureka/