2

We need a spring bean that will either

Prevent the framework from @Autowired -ing it.

or

Once it does its work it destroys itself?

The bean roughly looks like this:

public final class Registrar implements ApplicationListener<SOFrameworkInitializedEvent>

So after it receives this 1 time event do the work and go away. We are using Spring 3.0.7.

arinte
  • 3,660
  • 10
  • 45
  • 65

1 Answers1

2

Use the autowire-candidate property in the bean definition XML, e.g.:

  <bean id="MyBean" class="com.acme.SimpleTestServiceImpl" autowire-candidate="false"/>
Grzegorz Oledzki
  • 23,614
  • 16
  • 68
  • 106