From 83f9da757a936840e5b805bc9c7330a25de3cc2e Mon Sep 17 00:00:00 2001 From: zhouhao Date: Tue, 10 Oct 2017 23:21:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/web/UserTokenController.java | 107 ++++++++++++++++++ .../feign/FeignAuthenticationManager.java | 23 ++++ .../cloud/feign/FeignUserTokenManager.java | 46 ++++---- ...plication.java => GateWayApplication.java} | 4 +- .../src/main/resources/application.yml | 4 + .../hsweb-examples-cloud-service01/pom.xml | 77 +++++++++++++ .../cloud/service/Service01Application.java | 32 ++++++ .../cloud/service/UserInfoController.java | 19 ++++ .../src/main/resources/application.yml | 18 +++ .../src/main/resources/bootstrap.yml | 9 ++ .../hsweb-examples-cloud-user-center/pom.xml | 12 ++ .../cloud/user/UserCenterApplication.java | 22 +++- .../src/main/resources/application.yml | 2 +- hsweb-examples/hsweb-examples-cloud/pom.xml | 1 + .../web/starter/HswebAutoConfiguration.java | 7 +- 15 files changed, 353 insertions(+), 30 deletions(-) create mode 100644 hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/UserTokenController.java create mode 100644 hsweb-authorization/hsweb-authorization-cloud/src/main/java/org/hswebframework/web/authorization/cloud/feign/FeignAuthenticationManager.java rename hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/java/org/hswebframework/web/examples/cloud/gateway/{Application.java => GateWayApplication.java} (81%) create mode 100644 hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/pom.xml create mode 100644 hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/java/org/hswebframework/web/examples/cloud/service/Service01Application.java create mode 100644 hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/java/org/hswebframework/web/examples/cloud/service/UserInfoController.java create mode 100644 hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/resources/application.yml create mode 100644 hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/resources/bootstrap.yml diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/UserTokenController.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/UserTokenController.java new file mode 100644 index 000000000..754c33165 --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/web/UserTokenController.java @@ -0,0 +1,107 @@ +package org.hswebframework.web.authorization.basic.web; + +import org.hswebframework.web.authorization.Authentication; +import org.hswebframework.web.authorization.AuthenticationManager; +import org.hswebframework.web.authorization.token.TokenState; +import org.hswebframework.web.authorization.token.UserToken; +import org.hswebframework.web.authorization.token.UserTokenManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * Created by zhouhao on 2017/10/10. + */ +@RestController +@RequestMapping +public class UserTokenController { + + private UserTokenManager userTokenManager; + + private AuthenticationManager authenticationManager; + + @Autowired + @Lazy + public void setUserTokenManager(UserTokenManager userTokenManager) { + this.userTokenManager = userTokenManager; + } + + @Autowired + @Lazy + public void setAuthenticationManager(AuthenticationManager authenticationManager) { + this.authenticationManager = authenticationManager; + } + + @GetMapping("/user-token/token/{token}") + public UserToken getByToken(@PathVariable String token) { + return userTokenManager.getByToken(token); + } + + @GetMapping("/user-token/user/{userId}") + public List getByUserId(@PathVariable String userId){ + return userTokenManager.getByUserId(userId); + } + + @GetMapping("/user-token/user/{userId}/logged") + public boolean userIsLoggedIn(@PathVariable String userId){ + return userTokenManager.userIsLoggedIn(userId); + } + + @GetMapping("/user-token/token/{token}/logged") + public boolean tokenIsLoggedIn(@PathVariable String token){ + return userTokenManager.tokenIsLoggedIn(token); + } + + @GetMapping("/user-token/user/total") + public long totalUser(){ + return userTokenManager.totalUser(); + } + + @GetMapping("/user-token/token/total") + public long totalToken(){ + return userTokenManager.totalToken(); + } + + @GetMapping("/user-token}") + public List allLoggedUser(){ + return userTokenManager.allLoggedUser(); + } + + @DeleteMapping("/user-token/user/{userId}") + public void signOutByUserId(@PathVariable String userId){ + userTokenManager.signOutByUserId(userId); + } + + @DeleteMapping("/user-token/token/{token}") + public void signOutByToken(@PathVariable String token){ + userTokenManager.signOutByToken(token); + } + + @PutMapping("/user-token/user/{userId}/{state}") + public void changeUserState(@PathVariable String userId, @PathVariable TokenState state){ + userTokenManager.changeUserState(userId, state); + } + + @PutMapping("/user-token/token/{token}/{state}") + public void changeTokenState(String token, TokenState state){ + userTokenManager.changeTokenState(token,state); + } + + @PostMapping("/user-token/{token}/{userId}/{maxInactiveInterval}") + public UserToken signIn(@PathVariable String token, @PathVariable String userId, @PathVariable long maxInactiveInterval) + { + return userTokenManager.signIn(token,userId,maxInactiveInterval); + } + + @GetMapping("/user-token/{token}/touch") + public void touch(@PathVariable String token) { + userTokenManager.touch(token); + } + + @GetMapping("/user-auth/{userId}") + public Authentication userAuthInfo(@PathVariable String userId){ + return authenticationManager.getByUserId(userId); + } +} diff --git a/hsweb-authorization/hsweb-authorization-cloud/src/main/java/org/hswebframework/web/authorization/cloud/feign/FeignAuthenticationManager.java b/hsweb-authorization/hsweb-authorization-cloud/src/main/java/org/hswebframework/web/authorization/cloud/feign/FeignAuthenticationManager.java new file mode 100644 index 000000000..734983112 --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-cloud/src/main/java/org/hswebframework/web/authorization/cloud/feign/FeignAuthenticationManager.java @@ -0,0 +1,23 @@ +package org.hswebframework.web.authorization.cloud.feign; + +import org.hswebframework.web.authorization.Authentication; +import org.hswebframework.web.authorization.AuthenticationManager; +import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +/** + * Created by zhouhao on 2017/10/10. + */ +@FeignClient(name = "${hsweb.cloud.user-center.name:user-center}") +public interface FeignAuthenticationManager extends AuthenticationManager { + @Override + @RequestMapping(value = "/user-auth/{userId}",method = RequestMethod.GET) + Authentication getByUserId(@PathVariable("userId") String userId); + + @Override + @RequestMapping(value = "/user-auth",method = RequestMethod.PUT) + Authentication sync(Authentication authentication); +} diff --git a/hsweb-authorization/hsweb-authorization-cloud/src/main/java/org/hswebframework/web/authorization/cloud/feign/FeignUserTokenManager.java b/hsweb-authorization/hsweb-authorization-cloud/src/main/java/org/hswebframework/web/authorization/cloud/feign/FeignUserTokenManager.java index 7a66c0a10..39139c817 100644 --- a/hsweb-authorization/hsweb-authorization-cloud/src/main/java/org/hswebframework/web/authorization/cloud/feign/FeignUserTokenManager.java +++ b/hsweb-authorization/hsweb-authorization-cloud/src/main/java/org/hswebframework/web/authorization/cloud/feign/FeignUserTokenManager.java @@ -16,54 +16,54 @@ import java.util.List; public interface FeignUserTokenManager extends UserTokenManager { @Override - @GetMapping("/user-token/token/{token}") - UserToken getByToken(@PathVariable String token); + @RequestMapping(value = "/user-token/token/{token}",method = RequestMethod.GET) + UserToken getByToken(@PathVariable("token") String token); @Override - @GetMapping("/user-token/user/{userId}") - List getByUserId(@PathVariable String userId); + @RequestMapping(value = "/user-token/user/{userId}",method = RequestMethod.GET) + List getByUserId(@PathVariable("userId") String userId); @Override - @GetMapping("/user-token/user/{userId}/logged") - boolean userIsLoggedIn(@PathVariable String userId); + @RequestMapping(value = "/user-token/user/{userId}/logged",method = RequestMethod.GET) + boolean userIsLoggedIn(@PathVariable("userId") String userId); @Override - @GetMapping("/user-token/token/{token}/logged") - boolean tokenIsLoggedIn(@PathVariable String token); + @RequestMapping(value = "/user-token/token/{token}/logged",method = RequestMethod.GET) + boolean tokenIsLoggedIn(@PathVariable("token") String token); @Override - @GetMapping("/user-token/user/total") + @RequestMapping(value = "/user-token/user/total",method = RequestMethod.GET) long totalUser(); @Override - @GetMapping("/user-token/token/total") + @RequestMapping(value = "/user-token/token/total",method = RequestMethod.GET) long totalToken(); @Override - @GetMapping("/user-token}") + @RequestMapping(value = "/user-token",method = RequestMethod.GET) List allLoggedUser(); @Override - @DeleteMapping("/user-token/user/{userId}") - void signOutByUserId(@PathVariable String userId); + @RequestMapping(value = "/user-token/user/{userId}",method = RequestMethod.DELETE) + void signOutByUserId(@PathVariable("userId") String userId); @Override - @DeleteMapping("/user-token/token/{token}") - void signOutByToken(@PathVariable String token); + @RequestMapping(value = "/user-token/token/{token}",method = RequestMethod.DELETE) + void signOutByToken(@PathVariable("token") String token); @Override - @PutMapping("/user-token/user/{userId}/{state}") - void changeUserState(@PathVariable String userId, @PathVariable TokenState state); + @RequestMapping(value = "/user-token/user/{userId}/{state}",method = RequestMethod.PUT) + void changeUserState(@PathVariable("userId") String userId, @PathVariable("state") TokenState state); @Override - @PutMapping("/user-token/token/{token}/{state}") - void changeTokenState(String token, TokenState state); + @RequestMapping(value = "/user-token/token/{token}/{state}",method = RequestMethod.PUT) + void changeTokenState(@PathVariable("token") String token, @PathVariable("state") TokenState state); @Override - @PostMapping("/user-token/{token}/{userId}/{maxInactiveInterval}") - UserToken signIn(@PathVariable String token, @PathVariable String userId, @PathVariable long maxInactiveInterval); + @RequestMapping(value = "/user-token/{token}/{userId}/{maxInactiveInterval}",method = RequestMethod.POST) + UserToken signIn(@PathVariable("token") String token, @PathVariable("userId") String userId, @PathVariable("maxInactiveInterval") long maxInactiveInterval); @Override - @GetMapping("/user-token/{token}/touch") - void touch(String token); + @RequestMapping(value = "/user-token/{token}/touch",method = RequestMethod.GET) + void touch(@PathVariable("token") String token); } diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/java/org/hswebframework/web/examples/cloud/gateway/Application.java b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/java/org/hswebframework/web/examples/cloud/gateway/GateWayApplication.java similarity index 81% rename from hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/java/org/hswebframework/web/examples/cloud/gateway/Application.java rename to hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/java/org/hswebframework/web/examples/cloud/gateway/GateWayApplication.java index c926cf741..6af0a6a6e 100644 --- a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/java/org/hswebframework/web/examples/cloud/gateway/Application.java +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/java/org/hswebframework/web/examples/cloud/gateway/GateWayApplication.java @@ -8,8 +8,8 @@ import org.springframework.cloud.netflix.zuul.EnableZuulProxy; @SpringCloudApplication @EnableEurekaServer @EnableZuulProxy -public class Application { +public class GateWayApplication { public static void main(String[] args) { - SpringApplication.run(Application.class, args); + SpringApplication.run(GateWayApplication.class, args); } } \ No newline at end of file diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/resources/application.yml b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/resources/application.yml index 1278f7baf..68ff1f484 100644 --- a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/resources/application.yml +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-gateway/src/main/resources/application.yml @@ -12,6 +12,10 @@ zuul: user-center: path: /user-center/** service-id: user-center + service-1: + path: /service-1/** + service-id: service01 + add-host-header: true ribbon: eureka: enabled: true diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/pom.xml b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/pom.xml new file mode 100644 index 000000000..c6a945580 --- /dev/null +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/pom.xml @@ -0,0 +1,77 @@ + + + + hsweb-examples-cloud + org.hswebframework.web + 3.0-SNAPSHOT + + 4.0.0 + + hsweb-examples-cloud-service01 + + + + com.alibaba + druid + 1.0.26 + + + + org.hswebframework.web + hsweb-spring-boot-starter + ${project.version} + + + + org.hswebframework.web + hsweb-authorization-basic + ${project.version} + + + + org.hswebframework.web + hsweb-authorization-cloud + ${project.version} + + + + org.springframework.cloud + spring-cloud-starter-feign + + + org.hswebframework.web + hsweb-authorization-jwt + ${project.version} + + + org.springframework.boot + spring-boot-starter-logging + + + + org.hswebframework.web + hsweb-spring-boot-starter + ${project.version} + + + org.springframework.cloud + spring-cloud-starter-eureka + + + + org.springframework.cloud + spring-cloud-starter-hystrix + + + + ch.qos.logback + logback-classic + + + com.h2database + h2 + + + \ No newline at end of file diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/java/org/hswebframework/web/examples/cloud/service/Service01Application.java b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/java/org/hswebframework/web/examples/cloud/service/Service01Application.java new file mode 100644 index 000000000..debf7cc02 --- /dev/null +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/java/org/hswebframework/web/examples/cloud/service/Service01Application.java @@ -0,0 +1,32 @@ +package org.hswebframework.web.examples.cloud.service; + + +import feign.Feign; +import org.hswebframework.web.authorization.cloud.feign.FeignUserTokenManager; +import org.hswebframework.web.authorization.token.UserTokenManager; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.netflix.feign.EnableFeignClients; +import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.netflix.hystrix.EnableHystrix; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@SpringBootApplication +@EnableDiscoveryClient +@EnableHystrix +@Configuration +@EnableFeignClients("org.hswebframework.web.authorization.cloud.feign") +public class Service01Application { + +// @Bean +// public UserTokenManager userTokenManager(){ +// return Feign.builder().target(FeignUserTokenManager.class,"http://localhost:9000"); +// } + + + public static void main(String[] args) { + SpringApplication.run(Service01Application.class, args); + } +} \ No newline at end of file diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/java/org/hswebframework/web/examples/cloud/service/UserInfoController.java b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/java/org/hswebframework/web/examples/cloud/service/UserInfoController.java new file mode 100644 index 000000000..1e62ba928 --- /dev/null +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/java/org/hswebframework/web/examples/cloud/service/UserInfoController.java @@ -0,0 +1,19 @@ +package org.hswebframework.web.examples.cloud.service; + +import org.hswebframework.web.authorization.Authentication; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * Created by zhouhao on 2017/10/10. + */ +@RestController +@RequestMapping("/user-info") +public class UserInfoController { + + @GetMapping + public Authentication authentication(){ + return Authentication.current().orElse(null); + } +} diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/resources/application.yml b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/resources/application.yml new file mode 100644 index 000000000..031985df1 --- /dev/null +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/resources/application.yml @@ -0,0 +1,18 @@ +spring: + aop: + auto: true + datasource: + url : jdbc:h2:mem:permission_test_mem + username : sa + password : + type: com.alibaba.druid.pool.DruidDataSource + driver-class-name : org.h2.Driver +hsweb: + app: + name: 权限管理测试 + version: 3.0.0 +server: + port: 9001 +logging: + level: + org.hswebframework.web: debug diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/resources/bootstrap.yml b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/resources/bootstrap.yml new file mode 100644 index 000000000..c01881962 --- /dev/null +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-service01/src/main/resources/bootstrap.yml @@ -0,0 +1,9 @@ +spring: + application: + name: service01 + cloud: + discovery: + client: + simple: + local: + service-id: service01 \ No newline at end of file diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/pom.xml b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/pom.xml index 0020b174e..480dbc28a 100644 --- a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/pom.xml +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/pom.xml @@ -31,6 +31,18 @@ ${project.version} + + org.hswebframework.web + hsweb-authorization-basic + ${project.version} + + + + org.hswebframework.web + hsweb-authorization-jwt + ${project.version} + + org.springframework.boot spring-boot-starter-logging diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/src/main/java/org/hswebframework/web/examples/cloud/user/UserCenterApplication.java b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/src/main/java/org/hswebframework/web/examples/cloud/user/UserCenterApplication.java index 220886941..fbf0f5fd3 100644 --- a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/src/main/java/org/hswebframework/web/examples/cloud/user/UserCenterApplication.java +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/src/main/java/org/hswebframework/web/examples/cloud/user/UserCenterApplication.java @@ -1,15 +1,35 @@ package org.hswebframework.web.examples.cloud.user; +import org.h2.command.Command; +import org.hswebframework.web.entity.authorization.UserEntity; +import org.hswebframework.web.service.authorization.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.hystrix.EnableHystrix; +import org.springframework.context.annotation.Configuration; @SpringBootApplication @EnableDiscoveryClient @EnableHystrix -public class UserCenterApplication { +@Configuration +public class UserCenterApplication implements CommandLineRunner{ public static void main(String[] args) { SpringApplication.run(UserCenterApplication.class, args); } + + @Autowired + UserService userService; + + @Override + public void run(String... strings) throws Exception { + UserEntity userEntity= userService.createEntity(); + userEntity.setName("super user"); + userEntity.setUsername("admin"); + userEntity.setPassword("admin"); + + userService.insert(userEntity); + } } \ No newline at end of file diff --git a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/src/main/resources/application.yml b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/src/main/resources/application.yml index c26a66482..64f860678 100644 --- a/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/src/main/resources/application.yml +++ b/hsweb-examples/hsweb-examples-cloud/hsweb-examples-cloud-user-center/src/main/resources/application.yml @@ -12,7 +12,7 @@ hsweb: name: 权限管理测试 version: 3.0.0 server: - port: 9002 + port: 9000 logging: level: org.hswebframework.web: debug \ No newline at end of file diff --git a/hsweb-examples/hsweb-examples-cloud/pom.xml b/hsweb-examples/hsweb-examples-cloud/pom.xml index 2616cca9c..e26feea4f 100644 --- a/hsweb-examples/hsweb-examples-cloud/pom.xml +++ b/hsweb-examples/hsweb-examples-cloud/pom.xml @@ -14,6 +14,7 @@ hsweb-examples-cloud-gateway hsweb-examples-cloud-user-center + hsweb-examples-cloud-service01 diff --git a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java index 3effb59c2..1c45619c6 100644 --- a/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java +++ b/hsweb-starter/hsweb-spring-boot-starter/src/main/java/org/hswebframework/web/starter/HswebAutoConfiguration.java @@ -111,15 +111,16 @@ public class HswebAutoConfiguration { return super.getDeserializer(type); } checkAutoType(type.getTypeName(), ((Class) type)); - if (Modifier.isAbstract(classType.getModifiers()) || Modifier.isInterface(classType.getModifiers())) { - if (entityFactory != null && (Entity.class.isAssignableFrom(classType) || Model.class.isAssignableFrom(classType))) { - return new JavaBeanDeserializer(this, entityFactory.getInstanceType(classType), type); + Class realType; + if (entityFactory != null&& (realType=entityFactory.getInstanceType(classType))!=null) { + return new JavaBeanDeserializer(this, realType, type); } } else { return new JavaBeanDeserializer(this, classType); } } + return super.getDeserializer(type); } };