org.springframework.boot.context

Class ContextIdApplicationContextInitializer

  • java.lang.Object
    • org.springframework.boot.context.ContextIdApplicationContextInitializer
  • All Implemented Interfaces:
    org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>, org.springframework.core.Ordered


    public class ContextIdApplicationContextInitializer
    extends Object
    implements org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>, org.springframework.core.Ordered
    ApplicationContextInitializer that set the Spring ApplicationContext ID. The following environment properties will be consulted to create the ID:
    • spring.application.name
    • vcap.application.name
    • spring.config.name
    If no property is set the ID 'application' will be used.

    In addition the following environment properties will be consulted to append a relevant port or index:

    • spring.application.index
    • vcap.application.instance_index
    • PORT

    Author:
    Dave Syer
    • Constructor Detail

      • ContextIdApplicationContextInitializer

        public ContextIdApplicationContextInitializer()
      • ContextIdApplicationContextInitializer

        public ContextIdApplicationContextInitializer(String name)
        Parameters:
        name - the name of the application (can include placeholders)
    • Method Detail

      • setOrder

        public void setOrder(int order)
      • getOrder

        public int getOrder()
        Specified by:
        getOrder in interface org.springframework.core.Ordered
      • initialize

        public void initialize(org.springframework.context.ConfigurableApplicationContext applicationContext)
        Specified by:
        initialize in interface org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>

Copyright © 2017 Pivotal Software, Inc.. All rights reserved.