Presistent data when instantiating with service container

Given this very simple class

class FooTest {

protected $data;

public function set($data) {
   $this->data = $data;

public function get() {
   return $this->data;

And this form

class FooTestForm extends FormBase {

protected $ft;

public function buildForm(array $form, FormStateInterface $form_state) {

   if ($form_state->isSubmitted()) {
   else {
     // $this->ft = Drupal::service('foo.test');
     $this->ft = new FooTest();

   $form['actions']['submit'] = ['#type' => 'submit', '#value' => 'Submit'];

   return $form;

public function submitForm(array &$form, FormStateInterface $form_state) {

} // End class

If I instantiate the class using new I can click submit over and over and the data is persistent. It retains the value I set the first time through. However if I use the service container, as in the commented line above Drupal::service('foo.test');, the value persists through one submit but is null on subsequent submits. I would like to understand why.


Drupal version: