请告诉我如何正确使用 PodamFactory 进行填充。我在调用时得到StackOverflowError
(productList
源类列表)podamFactory.manufacturePojo(Product)
。
产品 (A) 来源:
public class Product {
private String productName;
private String productDescription;
private Double price;
private Boolean availability;
private List<Product> productList;
// getters & setters
}
例外:
Caused by: java.lang.StackOverflowError
sun.reflect.generics.parser.SignatureParser.parseSimpleClassTypeSignature(SignatureParser.java:253)
sun.reflect.generics.parser.SignatureParser.parseClassTypeSignatureSuffix(SignatureParser.java:270)
sun.reflect.generics.parser.SignatureParser.parseClassTypeSignature(SignatureParser.java:244)
sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:228)
sun.reflect.generics.parser.SignatureParser.parseTypeArgument(SignatureParser.java:319)
sun.reflect.generics.parser.SignatureParser.parseTypeArguments(SignatureParser.java:284)
sun.reflect.generics.parser.SignatureParser.parseSimpleClassTypeSignature(SignatureParser.java:260)
sun.reflect.generics.parser.SignatureParser.parseClassTypeSignatureSuffix(SignatureParser.java:270)
sun.reflect.generics.parser.SignatureParser.parseClassTypeSignature(SignatureParser.java:244)
sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:228)
sun.reflect.generics.parser.SignatureParser.parseTypeSignature(SignatureParser.java:359)
sun.reflect.generics.parser.SignatureParser.parseZeroOrMoreTypeSignatures(SignatureParser.java:469)
sun.reflect.generics.parser.SignatureParser.parseFormalParameters(SignatureParser.java:446)
sun.reflect.generics.parser.SignatureParser.parseMethodTypeSignature(SignatureParser.java:436)
sun.reflect.generics.parser.SignatureParser.parseMethodSig(SignatureParser.java:141)
sun.reflect.generics.repository.ConstructorRepository.parse(ConstructorRepository.java:37)
sun.reflect.generics.repository.ConstructorRepository.parse(ConstructorRepository.java:25)
sun.reflect.generics.repository.AbstractRepository.<init>(AbstractRepository.java:56)
sun.reflect.generics.repository.GenericDeclRepository.<init>(GenericDeclRepository.java:30)
sun.reflect.generics.repository.ConstructorRepository.<init>(ConstructorRepository.java:33)
sun.reflect.generics.repository.MethodRepository.<init>(MethodRepository.java:28)
sun.reflect.generics.repository.MethodRepository.make(MethodRepository.java:41)
java.lang.reflect.Method.getGenericInfo(Method.java:94)
java.lang.reflect.Method.getGenericParameterTypes(Method.java:282)
uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojoInternal(PodamFactoryImpl.java:1464)
uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojo(PodamFactoryImpl.java:109)
uk.co.jemos.podam.api.PodamFactoryImpl.manufactureAttributeValue(PodamFactoryImpl.java:1681)
uk.co.jemos.podam.api.PodamFactoryImpl.manufactureAttributeValue(PodamFactoryImpl.java:1568)
uk.co.jemos.podam.api.PodamFactoryImpl.fillCollection(PodamFactoryImpl.java:2078)
uk.co.jemos.podam.api.PodamFactoryImpl.resolveCollectionValueWhenCollectionIsPojoAttribute(PodamFactoryImpl.java:1973)
uk.co.jemos.podam.api.PodamFactoryImpl.manufactureAttributeValue(PodamFactoryImpl.java:1646)
uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojoInternal(PodamFactoryImpl.java:1485)
uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojo(PodamFactoryImpl.java:109)
uk.co.jemos.podam.api.PodamFactoryImpl.manufactureAttributeValue(PodamFactoryImpl.java:1681)
uk.co.jemos.podam.api.PodamFactoryImpl.manufactureAttributeValue(PodamFactoryImpl.java:1568)
uk.co.jemos.podam.api.PodamFactoryImpl.fillCollection(PodamFactoryImpl.java:2078)
uk.co.jemos.podam.api.PodamFactoryImpl.resolveCollectionValueWhenCollectionIsPojoAttribute(PodamFactoryImpl.java:1973)
uk.co.jemos.podam.api.PodamFactoryImpl.manufactureAttributeValue(PodamFactoryImpl.java:1646)
uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojoInternal(PodamFactoryImpl.java:1485)
uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojo(PodamFactoryImpl.java:109)
uk.co.jemos.podam.api.PodamFactoryImpl.manufactureAttributeValue(PodamFactoryImpl.java:1681)
uk.co.jemos.podam.api.PodamFactoryImpl.manufactureAttributeValue(PodamFactoryImpl.java:1568)
uk.co.jemos.podam.api.PodamFactoryImpl.fillCollection(PodamFactoryImpl.java:2078)