fix autowired
This commit is contained in:
parent
a26af73e44
commit
bc7c9cac3e
@ -16,7 +16,6 @@ import java.util.Map;
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonIgnoreProperties(ignoreUnknown = true) // 忽略未知属性字段
|
||||
@RequestScope
|
||||
public class RuntimeContext implements Serializable {
|
||||
@JsonProperty(RecordField.REQUEST_ID)
|
||||
private String requestId; // 本次请求request id
|
||||
@ -43,7 +42,7 @@ public class RuntimeContext implements Serializable {
|
||||
|
||||
// 序列化
|
||||
@Override
|
||||
public String toString() {
|
||||
public String toString() throws RuntimeException {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
try {
|
||||
return mapper.writeValueAsString(this);
|
||||
|
@ -32,8 +32,6 @@ import java.util.Map;
|
||||
@Component
|
||||
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
public class RequestInitFilter extends HttpFilter {
|
||||
@Autowired
|
||||
private ObjectFactory<RuntimeContext> requestScopedBeanFactory;
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
@ -45,7 +43,7 @@ public class RequestInitFilter extends HttpFilter {
|
||||
|
||||
@Override
|
||||
public void doFilter(HttpServletRequest httpServletRequest, HttpServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||
RuntimeContext runtimeContext = requestScopedBeanFactory.getObject();
|
||||
RuntimeContext runtimeContext = new RuntimeContext();
|
||||
setBaseInfo(httpServletRequest, runtimeContext); // 设置基础信息
|
||||
setRequestQuery(runtimeContext.getRequestInfo()); // 设置请求query信息
|
||||
setRequestBody(runtimeContext.getRequestInfo()); // 设置请求Body
|
||||
|
Loading…
x
Reference in New Issue
Block a user