本文整理汇总了Java中org.springframework.objenesis.ObjenesisStd类的典型用法代码示例。如果您正苦于以下问题:Java ObjenesisStd类的具体用法?Java ObjenesisStd怎么用?Java ObjenesisStd使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjenesisStd类属于org.springframework.objenesis包,在下文中一共展示了ObjenesisStd类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test1
import org.springframework.objenesis.ObjenesisStd; //导入依赖的package包/类
@Test
public void test1() throws IllegalAccessException, InstantiationException {
Objenesis objenesis = new ObjenesisStd(true);
Class<User> clazz = User.class;
long start = System.currentTimeMillis();
for(int i=0; i<10000000; i++) {
User user = objenesis.newInstance(clazz);
}
long end = System.currentTimeMillis();
System.out.println("objenesis: " + (end - start));
}
示例2: doDisableCaching
import org.springframework.objenesis.ObjenesisStd; //导入依赖的package包/类
private void doDisableCaching() {
try {
Class<?> type = ClassUtils.forName(
"org.springframework.hateoas.core.DummyInvocationUtils",
getClass().getClassLoader());
Field objenesis = ReflectionUtils.findField(type, "OBJENESIS");
if (objenesis != null) {
ReflectionUtils.makeAccessible(objenesis);
ReflectionUtils.setField(objenesis, null, new ObjenesisStd(false));
}
}
catch (Exception ex) {
// Assume that Spring HATEOAS is not on the classpath and continue
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:HateoasObjenesisCacheDisabler.java
示例3: ObjenesisCglibAopProxy
import org.springframework.objenesis.ObjenesisStd; //导入依赖的package包/类
/**
* Creates a new {@link ObjenesisCglibAopProxy} using the given {@link AdvisedSupport}.
* @param config must not be {@literal null}.
*/
public ObjenesisCglibAopProxy(AdvisedSupport config) {
super(config);
this.objenesis = new ObjenesisStd(true);
}