Commit 5accd407 by Thomas Bosch

some comments

parent efa71e4c
......@@ -12,6 +12,12 @@ import de.codecentric.boot.admin.config.WebappConfig;
@Import(WebappConfig.class)
public class SpringBootAdmin {
/**
* Starting point for application to boot.
*
* @param args
* Passed arguments.
*/
public static void main(String[] args) {
SpringApplication.run(SpringBootAdmin.class, args);
}
......
......@@ -14,16 +14,25 @@ import de.codecentric.boot.admin.service.ApplicationRegistry;
@Configuration
public class WebappConfig extends WebMvcConfigurerAdapter {
/**
* Add JSON MessageConverter to send JSON objects to web clients.
*/
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(new MappingJackson2HttpMessageConverter());
}
/**
* Controller with REST-API for spring-boot applications to register itself.
*/
@Bean
public RegistryController registryController() {
return new RegistryController();
}
/**
* Registry for all registered application.
*/
@Bean
public ApplicationRegistry applicationRegistry() {
return new ApplicationRegistry();
......
......@@ -26,6 +26,13 @@ public class RegistryController {
@Autowired
private ApplicationRegistry registry;
/**
* Register an application within this admin application.
*
* @param app
* The application infos.
* @return The registered application.
*/
@RequestMapping(value = "/api/applications", method = RequestMethod.POST)
@ResponseBody
public Application register(@RequestBody Application app) {
......@@ -33,6 +40,13 @@ public class RegistryController {
return registry.register(app);
}
/**
* Get a single application out of the registry.
*
* @param id
* The application identifier.
* @return The registered application.
*/
@RequestMapping(value = "/api/application/{id}", method = RequestMethod.GET)
@ResponseBody
public Application get(@PathVariable String id) {
......@@ -40,6 +54,11 @@ public class RegistryController {
return registry.getApplication(id);
}
/**
* List all registered applications.
*
* @return List.
*/
@RequestMapping(value = "/api/applications", method = RequestMethod.GET)
@ResponseBody
public List<Application> applications() {
......
......@@ -11,7 +11,8 @@ import org.springframework.stereotype.Service;
import de.codecentric.boot.admin.model.Application;
/**
* Registry for all applications that should be managed/administrated by the spring-boot-admin application.
* Registry for all applications that should be managed/administrated by the spring-boot-admin application. This
* registry is just "in-memory", so that after a restart all applications have to be registered again.
*/
@Service
public class ApplicationRegistry {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment