---
title: "Deprecation: #82975 - Deprecate usage of @inject with non-public properties"
manual: "TYPO3 Core Changelog"
version: "main"
permalink: "https://docs.typo3.org/permalink/changelog:deprecation-82975"
source: "Changelog/9.0/Deprecation-82975-DeprecateUsageOfInjectWithNonPublicProperties.rst"
modified: "2026-09-15T10:46:36+00:00"
---

# Deprecation: #82975 - Deprecate usage of @inject with non-public properties

See [forge#82975](https://forge.typo3.org/issues/82975)

## Description

When using private or protected properties for Dependency Injection via `@inject`, Extbase needs to
use the object reflection API to make these properties settable from the outside,
which is quite slow and cannot be cached in any way. Therefore property injection should
only work for public properties.

## Impact

Using `@inject` with a non-public property will trigger a deprecation warning and will
not work any longer in TYPO3 version 10.

## Affected Installations

All installations, that use property injection via `@inject` with non-public properties

## Migration

You have the following options to migrate:

-   Introduce an explicit `inject*()` method (e.g. `injectMyProperty()`)
-   Use constructor injection
-   Make the property public (think about whether this is desired in terms of software design)

An inject method would look like this:

```php
/**
 * @var MyFancyProperty $myFancyProperty
 */
private $myFancyProperty;

/**
 * @param MyFancyProperty $myFancyProperty
 */
public function injectMyFancyProperty(MyFancyProperty $myFancyProperty): void
{
   $this->myFancyProperty = $myFancyProperty;
}
```
