spring-projects/spring-framework · error · IllegalArgumentException
Neither 'targetObject' nor 'targetBeanName' specified, and P
Error message
Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean bean name '{}' does not follow 'beanName.property' syntax What it means
Error "Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean bean name '{}' does not follow 'beanName.property' syntax" thrown in spring-projects/spring-framework.
Source
Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java:176
@Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
String targetBeanName = this.targetBeanName;
if (this.targetBeanWrapper != null && targetBeanName != null) {
throw new IllegalArgumentException("Specify either 'targetObject' or 'targetBeanName', not both");
}
if (this.targetBeanWrapper == null && targetBeanName == null) {
if (this.propertyPath != null) {
throw new IllegalArgumentException(
"Specify 'targetObject' or 'targetBeanName' in combination with 'propertyPath'");
}
// No other properties specified: check bean name.
int dotIndex;
if (this.beanName == null || (dotIndex = this.beanName.indexOf('.')) <= 0) {
throw new IllegalArgumentException(
"Neither 'targetObject' nor 'targetBeanName' specified, and PropertyPathFactoryBean " +
"bean name '" + this.beanName + "' does not follow 'beanName.property' syntax");
}
targetBeanName = this.beanName.substring(0, dotIndex);
this.targetBeanName = targetBeanName;
this.propertyPath = this.beanName.substring(dotIndex + 1);
}
else if (this.propertyPath == null) {
// either targetObject or targetBeanName specified
throw new IllegalArgumentException("'propertyPath' is required");
}
if (this.targetBeanWrapper == null && StringUtils.hasLength(targetBeanName) &&
this.beanFactory.isSingleton(targetBeanName)) {
// Eagerly fetch singleton target bean, and determine result type.
Object bean = this.beanFactory.getBean(targetBeanName);
this.targetBeanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(bean);View on GitHub (pinned to e8729d0438)
When it happens
Trigger: Thrown at spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPathFactoryBean.java:176 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of spring-projects/spring-framework@e8729d0438 (2026-08-04).
Data as JSON: /data/errors/c78b16d9edf1c699.json.
Report an issue: GitHub.