package cc.catalysts.boot.structurizr.config;

import com.structurizr.Workspace;
import com.structurizr.api.StructurizrClient;
import com.structurizr.model.Model;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Klaus Lehner, Catalysts GmbH
 */
@Configuration
@EnableConfigurationProperties(value = {StructurizrConfigurationProperties.class})
public class StructurizrAutoConfiguration {

    @Bean
    Model model(Workspace workspace) {
        return workspace.getModel();
    }

    @Bean
    Workspace workspace(StructurizrConfigurationProperties config) {
        return new Workspace(config.getName(), config.getDescription());
    }

    @Bean
    StructurizrClient structurizrClient(StructurizrConfigurationProperties config) {
        StructurizrClient structurizrClient = new StructurizrClient(config.getUrl(), config.getKey(), config.getSecret());
        structurizrClient.setWorkspaceArchiveLocation(config.getWorkspaceArchiveLocation());
        return structurizrClient;
    }

}

@@ -40,16 +40,81 @@
 onfig;%0A%0A
+import cc.catalysts.boot.structurizr.service.StructurizrService;%0A
 import c
@@ -355,16 +355,77 @@
 n.Bean;%0A
+import org.springframework.context.annotation.ComponentScan;%0A
 import o
@@ -541,16 +541,78 @@
 uration%0A
+@ComponentScan(basePackageClasses = StructurizrService.class)%0A
 @EnableC

load service