com.foreach.across.modules.applicationinfo.extensions.DebugWebModuleExtension Maven / Gradle / Ivy
/*
* Copyright 2014 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 com.foreach.across.modules.applicationinfo.extensions;
import com.foreach.across.core.annotations.ModuleConfiguration;
import com.foreach.across.modules.applicationinfo.controllers.ApplicationInfoController;
import com.foreach.across.modules.applicationinfo.controllers.rest.ApplicationInfoRestController;
import com.foreach.across.modules.debugweb.DebugWebModule;
import com.foreach.across.modules.debugweb.DebugWebModuleSettings;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
/**
* Configuration that sets the default debug web dashboard to the application info controller.
*
* @author Arne Vandamme
* @since 1.0.1
*/
@ModuleConfiguration(DebugWebModule.NAME)
@Slf4j
class DebugWebModuleExtension
{
@Autowired
public void registerDashboardIfNecessary( DebugWebModuleSettings settings ) {
if ( StringUtils.equals( settings.getDashboard(), "/" ) ) {
LOG.trace( "Registering debug dashboard to application info controller" );
settings.setDashboard( ApplicationInfoController.PATH );
}
}
@Bean
public ApplicationInfoController applicationInfoController() {
return new ApplicationInfoController();
}
@Bean
public ApplicationInfoRestController applicationInfoRestController() {
return new ApplicationInfoRestController();
}
}