[[getting-started]]
== Getting started

Most service broker applications implement API or web UI endpoints beyond the Open Service Broker API endpoints.
These additional endpoints might provide information about the application, provide a dashboard UI, or provide controls over application behavior.
Developers may implement these additional endpoints with https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html[Spring WebFlux] or https://docs.spring.io/spring/docs/current/spring-framework-reference/web.html[Spring MVC].

NOTE: The Spring Cloud Open Service Broker starter does not include a transitive dependency on Spring WebFlux or Spring MVC. A Spring Boot web starter is required to activate the auto-configuration.

=== Maven dependencies

To use Spring Cloud Open Service Broker in a Spring web application, add the starter:

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-open-service-broker</artifactId>
            <version>${version}</version>
        </dependency>
    </dependencies>

=== Gradle dependencies

To use Spring Cloud Open Service Broker in a Spring web application, add the starter:

    dependencies {
        compile("org.springframework.cloud:spring-cloud-starter-open-service-broker:${version}")
    }

=== Configuring the service broker

See the https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#getting-started-first-application[Spring Boot documentation] for getting started building a Spring Boot application.

The framework provides default implementations of most of the components needed to implement a service broker.
In Spring Boot fashion, you can override the default behavior by providing your own implementation of Spring beans, and the framework will back away from its defaults.

To start, use the `@SpringBootApplication` annotation on the service broker's main application class:

    @SpringBootApplication
    public class Application {
        public static void main(String[] args) {
            SpringApplication.run(Application.class, args);
        }
    }

This will trigger the inclusion of the default configuration.

=== Customizing the Service Broker Endpoints Path

Sometimes, it is useful to customize the prefix for the service broker endpoints. For example, your application might be serving conflicting endpoints for another purpose. You can use the `spring.cloud.openservicebroker.base-path` property to change the prefix for your broker endpoints, as shown in the following example:

```
spring.cloud.openservicebroker.base-path=/broker
```

The preceding application.properties example changes the endpoint from `/` to `/broker/` (for example, /broker/v2/catalog).
