Skip to end of banner
Go to start of banner

Spring usage in inspectIT components

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The Spring Framework is used extensively in all inspectIT components. Currently we still have some differences between the components. This page tries to document the different ways we use Spring

Commons / CommonsCS

Both projects are Spring-enabled. Although they both do not start a Spring context, one can assume that all services are used from a spring container. Thus you can use Spring annotation like @Autowired to mark fields to be injected by Spring.

Agent

CMR

The CMR is fully Spring annotation enabled. Spring bean should be defined in the spring context. No requirement to have a setter for injection.

User Interface

The user interface runs within an OSGI container. This makes the direct use of Spring a bit difficult. Currently the approach for the user interface is to publish the necessary spring beans as osgi service. You can afterwards lookup the bean through the InspectIT class.

VersionService versionService = InspectIT.getService(VersionService.class)

Please note that in order for the injection to work you need to:

  1. Define the bean (in this example the version service) as a spring bean in context-model-main
  2. Publish the bean as osgi service in spring-context-model-osgi
  3. Provide a setter in the bean that you want to inject the bean into!

 

  • No labels