mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
style: 添加 MybatisLanguageDriverAutoConfiguration 注释,格式化代码。
This commit is contained in:
parent
64227136c4
commit
68e8816886
@ -1,17 +1,17 @@
|
|||||||
/**
|
/*
|
||||||
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
* Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
|
||||||
* <p>
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
* <p>
|
* <p>
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* <p>
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.mybatisflex.spring.boot;
|
package com.mybatisflex.spring.boot;
|
||||||
|
|
||||||
@ -30,117 +30,117 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 脚本语言驱动的自动配置,平常一般项目用不到,只为了同步 mybatis 自带的 MybatisLanguageDriverAutoConfiguration
|
* 脚本语言驱动的自动配置,平常一般项目用不到,只为了同步 MyBatis 自带的 MybatisLanguageDriverAutoConfiguration。
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@ConditionalOnClass(LanguageDriver.class)
|
@ConditionalOnClass(LanguageDriver.class)
|
||||||
public class MybatisLanguageDriverAutoConfiguration {
|
public class MybatisLanguageDriverAutoConfiguration {
|
||||||
|
|
||||||
private static final String CONFIGURATION_PROPERTY_PREFIX = "mybatis-flex.scripting-language-driver";
|
private static final String CONFIGURATION_PROPERTY_PREFIX = "mybatis-flex.scripting-language-driver";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration class for mybatis-freemarker 1.1.x or under.
|
* Configuration class for mybatis-freemarker 1.1.x or under.
|
||||||
*/
|
*/
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@ConditionalOnClass(FreeMarkerLanguageDriver.class)
|
@ConditionalOnClass(FreeMarkerLanguageDriver.class)
|
||||||
@ConditionalOnMissingClass("org.mybatis.scripting.freemarker.FreeMarkerLanguageDriverConfig")
|
@ConditionalOnMissingClass("org.mybatis.scripting.freemarker.FreeMarkerLanguageDriverConfig")
|
||||||
public static class LegacyFreeMarkerConfiguration {
|
public static class LegacyFreeMarkerConfiguration {
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
FreeMarkerLanguageDriver freeMarkerLanguageDriver() {
|
FreeMarkerLanguageDriver freeMarkerLanguageDriver() {
|
||||||
return new FreeMarkerLanguageDriver();
|
return new FreeMarkerLanguageDriver();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration class for mybatis-freemarker 1.2.x or above.
|
|
||||||
*/
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
|
||||||
@ConditionalOnClass({ FreeMarkerLanguageDriver.class, FreeMarkerLanguageDriverConfig.class })
|
|
||||||
public static class FreeMarkerConfiguration {
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean
|
|
||||||
FreeMarkerLanguageDriver freeMarkerLanguageDriver(FreeMarkerLanguageDriverConfig config) {
|
|
||||||
return new FreeMarkerLanguageDriver(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
/**
|
||||||
@ConditionalOnMissingBean
|
* Configuration class for mybatis-freemarker 1.2.x or above.
|
||||||
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".freemarker")
|
*/
|
||||||
public FreeMarkerLanguageDriverConfig freeMarkerLanguageDriverConfig() {
|
@Configuration(proxyBeanMethods = false)
|
||||||
return FreeMarkerLanguageDriverConfig.newInstance();
|
@ConditionalOnClass({FreeMarkerLanguageDriver.class, FreeMarkerLanguageDriverConfig.class})
|
||||||
}
|
public static class FreeMarkerConfiguration {
|
||||||
}
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
FreeMarkerLanguageDriver freeMarkerLanguageDriver(FreeMarkerLanguageDriverConfig config) {
|
||||||
|
return new FreeMarkerLanguageDriver(config);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
@Bean
|
||||||
* Configuration class for mybatis-velocity 2.0 or under.
|
@ConditionalOnMissingBean
|
||||||
*/
|
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".freemarker")
|
||||||
@Configuration(proxyBeanMethods = false)
|
public FreeMarkerLanguageDriverConfig freeMarkerLanguageDriverConfig() {
|
||||||
@ConditionalOnClass(org.mybatis.scripting.velocity.Driver.class)
|
return FreeMarkerLanguageDriverConfig.newInstance();
|
||||||
@ConditionalOnMissingClass("org.mybatis.scripting.velocity.VelocityLanguageDriverConfig")
|
}
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public static class LegacyVelocityConfiguration {
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean
|
|
||||||
org.mybatis.scripting.velocity.Driver velocityLanguageDriver() {
|
|
||||||
return new org.mybatis.scripting.velocity.Driver();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration class for mybatis-velocity 2.1.x or above.
|
|
||||||
*/
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
|
||||||
@ConditionalOnClass({ VelocityLanguageDriver.class, VelocityLanguageDriverConfig.class })
|
|
||||||
public static class VelocityConfiguration {
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnMissingBean
|
|
||||||
VelocityLanguageDriver velocityLanguageDriver(VelocityLanguageDriverConfig config) {
|
|
||||||
return new VelocityLanguageDriver(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
/**
|
||||||
@ConditionalOnMissingBean
|
* Configuration class for mybatis-velocity 2.0 or under.
|
||||||
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".velocity")
|
*/
|
||||||
public VelocityLanguageDriverConfig velocityLanguageDriverConfig() {
|
@Configuration(proxyBeanMethods = false)
|
||||||
return VelocityLanguageDriverConfig.newInstance();
|
@ConditionalOnClass(org.mybatis.scripting.velocity.Driver.class)
|
||||||
}
|
@ConditionalOnMissingClass("org.mybatis.scripting.velocity.VelocityLanguageDriverConfig")
|
||||||
}
|
@SuppressWarnings("deprecation")
|
||||||
|
public static class LegacyVelocityConfiguration {
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Bean
|
||||||
@ConditionalOnClass(ThymeleafLanguageDriver.class)
|
@ConditionalOnMissingBean
|
||||||
public static class ThymeleafConfiguration {
|
org.mybatis.scripting.velocity.Driver velocityLanguageDriver() {
|
||||||
@Bean
|
return new org.mybatis.scripting.velocity.Driver();
|
||||||
@ConditionalOnMissingBean
|
}
|
||||||
ThymeleafLanguageDriver thymeleafLanguageDriver(ThymeleafLanguageDriverConfig config) {
|
|
||||||
return new ThymeleafLanguageDriver(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
/**
|
||||||
@ConditionalOnMissingBean
|
* Configuration class for mybatis-velocity 2.1.x or above.
|
||||||
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".thymeleaf")
|
*/
|
||||||
public ThymeleafLanguageDriverConfig thymeleafLanguageDriverConfig() {
|
@Configuration(proxyBeanMethods = false)
|
||||||
return ThymeleafLanguageDriverConfig.newInstance();
|
@ConditionalOnClass({VelocityLanguageDriver.class, VelocityLanguageDriverConfig.class})
|
||||||
|
public static class VelocityConfiguration {
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
VelocityLanguageDriver velocityLanguageDriver(VelocityLanguageDriverConfig config) {
|
||||||
|
return new VelocityLanguageDriver(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".velocity")
|
||||||
|
public VelocityLanguageDriverConfig velocityLanguageDriverConfig() {
|
||||||
|
return VelocityLanguageDriverConfig.newInstance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This class provides to avoid the https://github.com/spring-projects/spring-boot/issues/21626 as workaround.
|
@Configuration(proxyBeanMethods = false)
|
||||||
@SuppressWarnings("unused")
|
@ConditionalOnClass(ThymeleafLanguageDriver.class)
|
||||||
private static class MetadataThymeleafLanguageDriverConfig extends ThymeleafLanguageDriverConfig {
|
public static class ThymeleafConfiguration {
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
ThymeleafLanguageDriver thymeleafLanguageDriver(ThymeleafLanguageDriverConfig config) {
|
||||||
|
return new ThymeleafLanguageDriver(config);
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".thymeleaf.dialect")
|
@Bean
|
||||||
@Override
|
@ConditionalOnMissingBean
|
||||||
public DialectConfig getDialect() {
|
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".thymeleaf")
|
||||||
return super.getDialect();
|
public ThymeleafLanguageDriverConfig thymeleafLanguageDriverConfig() {
|
||||||
}
|
return ThymeleafLanguageDriverConfig.newInstance();
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".thymeleaf.template-file")
|
// This class provides to avoid the https://github.com/spring-projects/spring-boot/issues/21626 as workaround.
|
||||||
@Override
|
@SuppressWarnings("unused")
|
||||||
public TemplateFileConfig getTemplateFile() {
|
private static class MetadataThymeleafLanguageDriverConfig extends ThymeleafLanguageDriverConfig {
|
||||||
return super.getTemplateFile();
|
|
||||||
}
|
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".thymeleaf.dialect")
|
||||||
|
@Override
|
||||||
|
public DialectConfig getDialect() {
|
||||||
|
return super.getDialect();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigurationProperties(CONFIGURATION_PROPERTY_PREFIX + ".thymeleaf.template-file")
|
||||||
|
@Override
|
||||||
|
public TemplateFileConfig getTemplateFile() {
|
||||||
|
return super.getTemplateFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user