cn.herodotus.engine.rest.protect.configuration.TenantConfiguration Maven / Gradle / Ivy
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2020-2030 郑庚伟 ZHENGGENGWEI (码匠君), Licensed under the AGPL License
*
* This file is part of Herodotus Engine.
*
* Herodotus Engine is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Herodotus Engine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package cn.herodotus.engine.rest.protect.configuration;
import cn.herodotus.engine.rest.protect.tenant.MultiTenantInterceptor;
import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
/**
* Description: 租户请求拦截配置
*
* @author : gengwei.zheng
* @date : 2022/9/6 11:48
*/
@AutoConfiguration
public class TenantConfiguration {
private static final Logger log = LoggerFactory.getLogger(TenantConfiguration.class);
@PostConstruct
public void postConstruct() {
log.debug("[Herodotus] |- SDK [Protect Tenant] Auto Configure.");
}
@Bean
@ConditionalOnMissingBean
public MultiTenantInterceptor tenantInterceptor() {
MultiTenantInterceptor multiTenantInterceptor = new MultiTenantInterceptor();
log.trace("[Herodotus] |- Bean [Idempotent Interceptor] Auto Configure.");
return multiTenantInterceptor;
}
}