代码实现java8元空间溢出
写点笔记
共 1493字,需浏览 3分钟
·
2021-04-22 22:39
public class UserController {
Logger logger= LoggerFactory.getLogger(UserController.class);
private ThreadService threadService;
public String TEST(){
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(User.class);
enhancer.setUseCache(false);
enhancer.setCallback(new MethodInterceptor() {
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
return proxy.invoke(obj, args);
}
});
Object o=enhancer.create();
System.out.println(o.toString());
User user=threadService.getUser();
logger.info(user.toString());
user.setUserName("1");
return "success";
}
}
评论