hibernate/hibernate-orm · error · HibernateException

ServiceRegistry not yet injected; PropertyAccessStrategyReso

Error message

ServiceRegistry not yet injected; PropertyAccessStrategyResolver not ready for use.

What it means

Error "ServiceRegistry not yet injected; PropertyAccessStrategyResolver not ready for use." thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/property/access/internal/PropertyAccessStrategyResolverStandardImpl.java:77

		else {
			return BASIC.getStrategy();
		}
	}

	protected PropertyAccessStrategy resolveExplicitlyNamedPropertyAccessStrategy(String explicitAccessStrategyName) {
		final var builtInStrategyEnum = BuiltInPropertyAccessStrategies.interpret( explicitAccessStrategyName );
		return builtInStrategyEnum != null
				? builtInStrategyEnum.getStrategy()
				: strategySelectorService().resolveStrategy( PropertyAccessStrategy.class, explicitAccessStrategyName );

	}

	private @Nullable StrategySelector strategySelectorService;

	protected StrategySelector strategySelectorService() {
		if ( strategySelectorService == null ) {
			if ( serviceRegistry == null ) {
				throw new HibernateException( "ServiceRegistry not yet injected; PropertyAccessStrategyResolver not ready for use." );
			}
			strategySelectorService = serviceRegistry.requireService( StrategySelector.class );
		}
		return strategySelectorService;
	}

}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Access the PropertyAccessStrategyResolver only after bootstrap completes and the ServiceRegistry is injected.
  2. Resolve strategies through the SessionFactory's ServiceRegistry instead of a manually created instance.

When it happens

Trigger: A runtime precondition of the Hibernate API is violated.

Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/515773f6b6f76203. Report an issue: GitHub.