Commit 2494fd30 authored by suntao's avatar suntao

Merge branch 'v1' into branch-suntao

* v1:
  修改异常信息捕获返回的message
  修改异常信息捕获返回的message
  数据源配置添加通配符
parents 4354c86c b088879e
...@@ -6,6 +6,7 @@ import cn.quantgroup.cashloanflowboss.core.dictionary.ApplicationStatus; ...@@ -6,6 +6,7 @@ import cn.quantgroup.cashloanflowboss.core.dictionary.ApplicationStatus;
import cn.quantgroup.cashloanflowboss.core.exception.ApplicationException; import cn.quantgroup.cashloanflowboss.core.exception.ApplicationException;
import com.fasterxml.jackson.core.io.JsonEOFException; import com.fasterxml.jackson.core.io.JsonEOFException;
import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonMappingException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; ...@@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
* <p> * <p>
* Created by WeiWei on 2017/5/2. * Created by WeiWei on 2017/5/2.
*/ */
@Slf4j
@Order(1) @Order(1)
@Component @Component
@RestControllerAdvice @RestControllerAdvice
...@@ -34,7 +36,8 @@ public class ApplicationExceptionConfiguration { ...@@ -34,7 +36,8 @@ public class ApplicationExceptionConfiguration {
*/ */
@ExceptionHandler({ApplicationException.class}) @ExceptionHandler({ApplicationException.class})
public Result applicationExceptionHandler(ApplicationException e) { public Result applicationExceptionHandler(ApplicationException e) {
return new Result<>(e.getStatus(), null, e.getMessage()); log.error("程序员开小差了,系统异常信息:{}", e.getMessage());
return new Result<>(e.getStatus(), null, e.getStatus().getMessage());
} }
/** /**
...@@ -102,7 +105,10 @@ public class ApplicationExceptionConfiguration { ...@@ -102,7 +105,10 @@ public class ApplicationExceptionConfiguration {
} }
} }
return new Result<>(ApplicationStatus.INTERNAL_SERVICE_ERROR, ApplicationException.class.isAssignableFrom(e.getClass()) ? cause.getMessage() : e.getMessage()); String errorMessage = ApplicationException.class.isAssignableFrom(e.getClass()) ? cause.getMessage() : e.getMessage();
log.error("程序员开小差了,未明确的异常信息:{}", errorMessage);
return new Result<>(ApplicationStatus.INTERNAL_SERVICE_ERROR, ApplicationStatus.INTERNAL_SERVICE_ERROR.getMessage());
} }
......
...@@ -20,9 +20,9 @@ import javax.persistence.EntityManagerFactory; ...@@ -20,9 +20,9 @@ import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource; import javax.sql.DataSource;
@Configuration @Configuration
@EntityScan(basePackages = {"cn.quantgroup.cashloanflowboss.api.user.entity.boss"}) @EntityScan(basePackages = {"cn.quantgroup.cashloanflowboss.api.*.entity.boss"})
@EnableTransactionManagement @EnableTransactionManagement
@EnableJpaRepositories(basePackages = {"cn.quantgroup.cashloanflowboss.api.user.repository.boss"}, @EnableJpaRepositories(basePackages = {"cn.quantgroup.cashloanflowboss.api.*.repository.boss"},
entityManagerFactoryRef = "bossEntityManager", entityManagerFactoryRef = "bossEntityManager",
transactionManagerRef = "bossTransactionManager") transactionManagerRef = "bossTransactionManager")
public class BossDSConfig { public class BossDSConfig {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment