/*
 * Copyright 2002-2017 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.cloud.servicebroker.autoconfigure.web.servlet;

import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.cloud.servicebroker.model.BrokerApiVersion;
import org.springframework.cloud.servicebroker.model.Catalog;
import org.springframework.cloud.servicebroker.service.ServiceInstanceService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * {@link EnableAutoConfiguration Auto-configuration} for the service broker API validation.
 * Configures support for any service broker API version if a version is not specifically
 * configured.
 *
 * @author Benjamin Ihrig
 * @author Scott Frederick
 */
@Configuration
@ConditionalOnWebApplication
@ConditionalOnBean({ Catalog.class, ServiceInstanceService.class })
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
public class ApiVersionAutoConfiguration {
	@Bean
	@ConditionalOnMissingBean(BrokerApiVersion.class)
	public BrokerApiVersion serviceBrokerApiVersion() {
		return new BrokerApiVersion();
	}

	@Bean
	public ApiVersionInterceptor serviceBrokerApiVersionInterceptor(BrokerApiVersion brokerApiVersion) {
		return new ApiVersionInterceptor(brokerApiVersion);
	}

	@Bean
	public ApiVersionWebMvcConfigurerAdapter serviceBrokerWebMvcConfigurerAdapter(
			ApiVersionInterceptor apiVersionInterceptor) {
		return new ApiVersionWebMvcConfigurerAdapter(
				apiVersionInterceptor);
	}
}

@@ -1780,24 +1780,73 @@
 bApplication
+(type = ConditionalOnWebApplication.Type.SERVLET)
 %0A@Conditiona
@@ -1854,17 +1854,16 @@
 OnBean(%7B
- 
 Catalog.
@@ -1897,17 +1897,16 @@
 ce.class
- 
 %7D)%0A@Auto
@@ -1951,16 +1951,16 @@
 .class)%0A
-
 public c
@@ -1994,16 +1994,17 @@
 ation %7B%0A
+%0A
 %09@Bean%0A%09
@@ -2498,13 +2498,8 @@
 ter(
-%0A%09%09%09%09
 apiV
@@ -2521,10 +2521,11 @@
 or);%0A%09%7D%0A
+%0A
 %7D%0A

Make ApiVersionAutoConfiguration conditional servlet web applications