Package io.hawt.sample.spring.boot

Source Code of io.hawt.sample.spring.boot.SampleSpringBootService

package io.hawt.sample.spring.boot;

import io.hawt.config.ConfigFacade;
import io.hawt.springboot.HawtPlugin;
import io.hawt.springboot.PluginService;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@EnableAutoConfiguration
@Configuration
public class SampleSpringBootService {

    public static void main(String[] args) {
        new SpringApplication(SampleSpringBootService.class).run();
    }

  /**
   * Loading an example plugin
   * @return
   */
  @Bean
  public HawtPlugin samplePlugin() {
    return new HawtPlugin("sample-plugin", "/hawtio/plugins", "", new String[] { "sample-plugin/js/sample-plugin.js" });
  }
 
  /**
   * Set things up to be in offline mode
   * @return
   * @throws Exception
   */
  @Bean
  public ConfigFacade configFacade() throws Exception {
    ConfigFacade config = new ConfigFacade() {
      public boolean isOffline() {
        return true;
      }
    };
    config.init();
    return config;
  }
 
  /**
   * Register rest endpoint to handle requests for /plugin, and return all registered plugins.
   * @return
   */
  @Bean
  public PluginService pluginService(){
    return new PluginService();
  }
}
TOP

Related Classes of io.hawt.sample.spring.boot.SampleSpringBootService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.