Spring Boot的application.yml属性大全

一、Server 配置属性表格:

序号配置属性描述
1server.port配置应用程序的监听端口(默认8080)
2server.address配置绑定的网络地址(绑定特定IP)
3server.servlet.context-path配置应用程序的上下文路径
4server.servlet.session.timeout配置会话超时时间,格式如 30m20s
5server.servlet.session.cookie.name配置会话Cookie的名称
6server.servlet.session.cookie.http-only配置会话Cookie是否设置 HttpOnly 属性(默认 true)
7server.servlet.session.cookie.secure配置会话Cookie是否设置为 Secure(仅限HTTPS,默认条件判断)
8server.ssl.enabled启用或禁用SSL(默认 false)
9server.ssl.key-store配置SSL密钥库的位置
10server.ssl.key-store-password配置SSL密钥库的密码
11server.ssl.key-password配置SSL密钥的密码
12server.ssl.trust-store配置SSL信任库的位置
13server.ssl.trust-store-password配置SSL信任库的密码
14server.ssl.enabled-protocols配置允许的SSL协议
15server.ssl.ciphers配置支持的SSL加密算法
16server.compression.enabled启用或禁用响应压缩(默认 false)
17server.compression.mime-types配置允许压缩的MIME类型
18server.compression.min-response-size配置允许压缩的最小响应大小(例如 2KB
19server.http2.enabled启用或禁用HTTP/2支持(默认 false)
20server.error.whitelabel.enabled启用或禁用白标错误页面(默认 true)
21server.error.include-stacktrace配置错误响应中是否包含堆栈跟踪(neveralwayson-trace-param
22server.tomcat.max-threads配置Tomcat的最大工作线程数
23server.tomcat.min-spare-threads配置Tomcat的最小空闲线程数
24server.tomcat.uri-encoding配置Tomcat的URI编码
25server.tomcat.max-connections配置Tomcat的最大连接数
26server.tomcat.accept-count配置Tomcat的最大排队连接数
27server.jetty.max-threads配置Jetty的最大工作线程数
28server.jetty.min-threads配置Jetty的最小工作线程数
29server.jetty.accept-queue-size配置Jetty的最大排队连接数
30server.undertow.accesslog.dir配置Undertow访问日志的目录
31server.undertow.accesslog.enabled启用或禁用Undertow的访问日志
32server.undertow.buffer-size配置Undertow的缓冲区大小
33server.undertow.io-threads配置Undertow的I/O线程数
34server.undertow.worker-threads配置Undertow的工作线程数
35server.shutdown配置优雅关机行为(immediategraceful,默认 immediate
36server.max-http-header-size配置最大HTTP头部大小(默认8KB)
37server.max-http-post-size配置最大HTTP POST请求大小

这份表格列出了 Spring Boot 中用于服务器配置的主要属性。这些属性可以帮助开发者根据需求调整和优化服务器的行为。你可以通过在 application.yml 中使用这些属性来进行服务器的具体配置。

二、Datasource 配置属性表格:

序号配置属性描述
1spring.datasource.url数据源的JDBC URL
2spring.datasource.username数据库用户名
3spring.datasource.password数据库密码
4spring.datasource.driver-class-name数据源的JDBC驱动类名
5spring.datasource.platform数据库平台类型(mysql, postgresql, h2等)
6spring.datasource.initialization-mode配置数据源的初始化模式(always, embedded, never
7spring.datasource.schema指定要加载的SQL脚本文件路径(用于数据库模式初始化)
8spring.datasource.data指定要加载的数据SQL脚本文件路径
9spring.datasource.continue-on-error配置在初始化SQL出错时是否继续执行(默认 false)
10spring.datasource.separator配置SQL脚本中的语句分隔符(默认 ;
11spring.datasource.sql-script-encoding配置SQL脚本的编码格式
12spring.datasource.hikari.connection-timeoutHikariCP连接超时时间(默认30秒)
13spring.datasource.hikari.maximum-pool-sizeHikariCP最大连接池大小(默认10)
14spring.datasource.hikari.minimum-idleHikariCP最小空闲连接数
15spring.datasource.hikari.max-lifetimeHikariCP连接的最大生命周期(默认30分钟)
16spring.datasource.hikari.idle-timeoutHikariCP空闲连接超时时间(默认600秒)
17spring.datasource.hikari.pool-nameHikariCP连接池的名称
18spring.datasource.hikari.leak-detection-thresholdHikariCP连接泄漏检测的阈值(默认0,即禁用)
19spring.datasource.hikari.validation-timeoutHikariCP连接验证超时时间
20spring.datasource.hikari.auto-commitHikariCP是否自动提交事务(默认 true)
21spring.datasource.tomcat.initial-sizeTomcat JDBC连接池的初始连接数
22spring.datasource.tomcat.max-activeTomcat JDBC连接池的最大活跃连接数
23spring.datasource.tomcat.max-idleTomcat JDBC连接池的最大空闲连接数
24spring.datasource.tomcat.min-idleTomcat JDBC连接池的最小空闲连接数
25spring.datasource.tomcat.max-waitTomcat JDBC连接池等待连接的最长时间
26spring.datasource.tomcat.test-on-borrow配置从连接池获取连接时是否进行连接验证
27spring.datasource.tomcat.test-on-return配置归还连接时是否进行连接验证
28spring.datasource.tomcat.test-while-idle配置空闲时是否进行连接验证
29spring.datasource.tomcat.validation-query配置连接验证时的SQL查询语句
30spring.datasource.tomcat.time-between-eviction-runs-millisTomcat JDBC连接池中运行空闲连接回收器的时间间隔(毫秒)
31spring.datasource.tomcat.min-evictable-idle-time-millisTomcat JDBC连接池中连接的最小空闲时间(毫秒)
32spring.datasource.dbcp2.initial-sizeDBCP2 连接池的初始连接数
33spring.datasource.dbcp2.max-totalDBCP2 连接池的最大连接数
34spring.datasource.dbcp2.max-idleDBCP2 连接池的最大空闲连接数
35spring.datasource.dbcp2.min-idleDBCP2 连接池的最小空闲连接数
36spring.datasource.dbcp2.max-wait-millisDBCP2 等待连接的最大时间
37spring.datasource.dbcp2.test-on-borrowDBCP2 从连接池获取连接时是否验证连接
38spring.datasource.dbcp2.test-on-returnDBCP2 归还连接时是否验证连接
39spring.datasource.dbcp2.test-while-idleDBCP2 空闲时是否验证连接
40spring.datasource.dbcp2.validation-queryDBCP2 验证连接时使用的SQL查询语句
41spring.datasource.dbcp2.time-between-eviction-runs-millisDBCP2 空闲连接回收器的运行间隔(毫秒)
42spring.datasource.dbcp2.min-evictable-idle-time-millisDBCP2 连接的最小空闲时间(毫秒)

这份表格列出了 Spring Boot 中常用的数据源配置属性,涵盖了不同连接池的常见配置,如 HikariCP、Tomcat JDBC 连接池和 DBCP2。通过这些属性,你可以灵活配置数据库连接池的行为和性能。

三、Security 配置属性表格:

序号配置属性描述
1spring.security.user.name配置默认用户的用户名(默认为 user
2spring.security.user.password配置默认用户的密码
3spring.security.user.roles配置默认用户的角色
4spring.security.enabled启用或禁用安全配置(默认为启用)
5spring.security.oauth2.client.registration配置 OAuth2 客户端注册信息
6spring.security.oauth2.client.provider配置 OAuth2 提供者信息
7spring.security.oauth2.client.client-id配置 OAuth2 客户端ID
8spring.security.oauth2.client.client-secret配置 OAuth2 客户端密钥
9spring.security.oauth2.client.scope配置 OAuth2 授权范围
10spring.security.oauth2.client.redirect-uri配置 OAuth2 授权的回调URI
11spring.security.oauth2.client.authorization-grant-type配置 OAuth2 授权类型(如 authorization_code, client_credentials
12spring.security.oauth2.resourceserver.jwt.jwk-set-uri配置JWT资源服务器的公钥集URI
13spring.security.oauth2.resourceserver.jwt.issuer-uri配置JWT资源服务器的颁发者URI
14spring.security.oauth2.resourceserver.jwt.jws-algorithm配置JWT资源服务器使用的签名算法
15spring.security.oauth2.resourceserver.opaque.introspection-uri配置 Opaque Token 资源服务器的检查URI
16spring.security.oauth2.resourceserver.opaque.introspection-client-id配置 Opaque Token 检查的客户端ID
17spring.security.oauth2.resourceserver.opaque.introspection-client-secret配置 Opaque Token 检查的客户端密钥
18spring.security.saml2.relyingparty.registration配置 SAML2 依赖方的注册信息
19spring.security.saml2.relyingparty.provider.signing-certificates配置 SAML2 提供者的签名证书
20spring.security.saml2.relyingparty.provider.encryption-certificates配置 SAML2 提供者的加密证书
21spring.security.saml2.relyingparty.provider.sso-url配置 SAML2 单点登录的URL
22spring.security.saml2.relyingparty.provider.entity-id配置 SAML2 提供者的实体ID
23spring.security.form-login.enabled配置是否启用表单登录
24spring.security.form-login.login-page配置自定义登录页面的路径
25spring.security.form-login.failure-url配置登录失败后跳转的页面
26spring.security.form-login.default-target-url配置登录成功后跳转的默认页面
27spring.security.form-login.username-parameter配置登录表单中用户名的参数名
28spring.security.form-login.password-parameter配置登录表单中密码的参数名
29spring.security.form-login.remember-me.enabled启用或禁用 “记住我” 功能
30spring.security.form-login.remember-me.token-validity-seconds配置“记住我” token的有效时间
31spring.security.headers.frame-options.mode配置是否启用 X-Frame-Options 头(防止点击劫持)
32spring.security.headers.hsts.enabled是否启用HTTP严格传输安全(HSTS)
33spring.security.headers.content-security-policy配置内容安全策略头
34spring.security.headers.xss-protection.enabled是否启用XSS保护
35spring.security.csrf.enabled是否启用CSRF保护(默认启用)
36spring.security.csrf.cookie-name配置CSRF Cookie的名称
37spring.security.csrf.header-name配置CSRF头部的名称
38spring.security.jwt.token-validity-seconds配置JWT的有效期(单位为秒)
39spring.security.jwt.secret配置JWT的签名密钥
40spring.security.jwt.issuer配置JWT的签发者
41spring.security.jwt.audience配置JWT的接收方
42spring.security.password.encoder配置密码的编码器(如 bcrypt
43spring.security.password.strength配置密码编码的强度
44spring.security.session-management.session-creation-policy配置会话创建策略(如 always, if_required, never
45spring.security.session-management.maximum-sessions配置每个用户允许的最大会话数量
46spring.security.session-management.expired-url配置会话过期后的跳转URL
47spring.security.anonymous.enabled是否启用匿名访问
48spring.security.anonymous.authorities配置匿名用户的角色
49spring.security.anonymous.key配置匿名用户的密钥
50spring.security.enable-global-method-security启用全局方法安全性注解(如 @PreAuthorize, @Secured

这份表格展示了 Spring Boot 中常见的 Security 配置属性,涵盖了用户身份验证、OAuth2、SAML2、JWT、表单登录、安全头配置、CSRF 保护等多个方面。通过这些配置,开发者可以灵活地自定义应用程序的安全机制。

以下是 Spring Boot 中 application.yml 文件中常见的 Logging(日志)配置属性列表。它们用于配置日志级别、日志输出位置、格式等功能。

四、Logging 配置属性表格:

序号配置属性描述
1logging.level.*配置特定包或类的日志级别(如 DEBUG, INFO, WARN, ERROR, TRACE
2logging.file.name配置日志文件的完整路径(不带路径时在当前目录)
3logging.file.path配置日志文件的保存目录(日志文件名默认为 spring.log
4logging.file.max-size配置日志文件的最大大小(如 10MB),到达此大小时日志会滚动
5logging.file.max-history配置保留的日志文件历史的最大数量
6logging.file.total-size-cap配置所有日志文件的总大小上限
7logging.pattern.console配置控制台输出的日志格式
8logging.pattern.file配置文件输出的日志格式
9logging.pattern.level配置日志级别的显示格式
10logging.pattern.dateformat配置日志条目中时间戳的格式
11logging.group.*创建自定义的日志分组(多个包可被分组到一个日志级别)
12logging.logback.rollingpolicy.file-name-pattern配置日志滚动策略的文件名模式
13logging.logback.rollingpolicy.clean-history-on-start启动时清理历史日志文件
14logging.logback.rollingpolicy.max-file-size配置单个日志文件的最大大小
15logging.logback.rollingpolicy.max-history配置保留的滚动日志文件的最大数量
16logging.logback.rollingpolicy.total-size-cap配置所有滚动日志文件的大小上限
17logging.logback.compress启用或禁用日志文件压缩
18logging.logback.encoder.pattern配置Logback的日志格式
19logging.file.clean-history-on-start启动时清理旧的日志文件
20logging.level.root配置根日志级别
21logging.config配置日志系统的配置文件路径(如 logback-spring.xml
22logging.exception-conversion-word配置异常转换的样式
23logging.file.log-backup-count配置日志文件的备份数量
24logging.file.rotation-policy配置日志文件的滚动策略
25logging.stdout.level配置标准输出的日志级别
26logging.stdout.charset配置标准输出的字符集
27logging.stdout.pattern配置标准输出的日志格式
28logging.stdout.file-backup-count配置标准输出的备份日志文件数量
29logging.json.enabled启用或禁用JSON格式的日志输出
30logging.json.include-stacktrace配置是否在JSON日志中包含异常堆栈
31logging.json.include-thread配置是否在JSON日志中包含线程信息
32logging.json.date-format配置JSON日志中时间戳的格式
33logging.logback.debug启用Logback调试日志
34logging.logback.jul-bridge.enabled启用或禁用Java Util Logging (JUL) 与 SLF4J的桥接
35logging.file.date-format配置日志文件的时间戳格式
36logging.register-shutdown-hook启用或禁用日志系统关闭钩子
37logging.trace.enabled启用或禁用TRACE级别日志
38logging.debug.enabled启用或禁用DEBUG级别日志
39logging.console.color.enabled启用或禁用控制台日志输出的颜色(默认启用)
40logging.console.charset配置控制台输出的字符集
41logging.filter.level配置日志过滤的日志级别
42logging.handler.console.enabled启用或禁用控制台日志输出
43logging.handler.file.enabled启用或禁用文件日志输出

这份表格列出了 Spring Boot 中常见的日志配置属性,涵盖了日志级别、日志输出位置、日志文件滚动策略等方面。开发者可以根据应用程序的需求,灵活配置日志输出的格式、内容和策略。

五、Spring MVC 配置属性表格:

序号配置属性描述
1spring.mvc.view.prefix配置视图解析器的前缀路径
2spring.mvc.view.suffix配置视图解析器的后缀路径
3spring.mvc.servlet.path配置Spring MVC主Servlet的路径
4spring.mvc.static-path-pattern配置静态资源的路径模式(如 /static/**
5spring.mvc.format.date配置日期的全局格式化
6spring.mvc.format.time配置时间的全局格式化
7spring.mvc.format.date-time配置日期和时间的全局格式化
8spring.mvc.locale配置默认的Locale(如 en_US
9spring.mvc.locale-resolver配置Locale解析策略(如 fixed, accept-header
10spring.mvc.async.request-timeout配置异步请求的超时时间(毫秒)
11spring.mvc.contentnegotiation.enabled启用或禁用内容协商功能
12spring.mvc.contentnegotiation.favor-parameter配置是否通过请求参数进行内容协商(如 format=json
13spring.mvc.contentnegotiation.parameter-name配置内容协商的请求参数名
14spring.mvc.contentnegotiation.favor-path-extension配置是否通过路径扩展名进行内容协商(如 .json, .xml
15spring.mvc.contentnegotiation.ignore-unknown-path-extensions配置是否忽略未知的路径扩展名
16spring.mvc.contentnegotiation.use-registered-extensions-only配置是否仅使用已注册的文件扩展名进行内容协商
17spring.mvc.media-types.*配置自定义的媒体类型(如 html, json
18spring.mvc.message-codes-resolver-format配置用于数据绑定错误的消息编码格式
19spring.mvc.hiddenmethod.filter.enabled启用或禁用HTTP隐藏方法过滤器(允许 _method 参数提交 PUT, DELETE 请求)
20spring.mvc.throw-exception-if-no-handler-found配置在没有找到请求处理器时是否抛出异常
21spring.mvc.log-resolved-exception配置是否记录处理过的异常
22spring.mvc.pathmatch.matching-strategy配置URL路径匹配策略(如 ant_path_matcher, path_pattern_parser
23spring.mvc.pathmatch.use-suffix-pattern是否启用后缀模式匹配(如 /resource.* 匹配 /resource.html
24spring.mvc.pathmatch.use-registered-suffix-pattern是否仅使用已注册的后缀模式匹配
25spring.mvc.static-locations配置静态资源的默认位置(如 classpath:/static/, classpath:/public/
26spring.mvc.ignore-default-model-on-redirect配置是否在重定向时忽略默认模型
27spring.mvc.favicon.enabled启用或禁用默认的favicon处理
28spring.mvc.formcontent.putfilter.enabled启用或禁用表单数据PUT请求的支持
29spring.mvc.json.prefix-json启用或禁用JSON响应的安全前缀
30spring.mvc.default-servlet.enabled启用或禁用默认的Servlet处理静态资源
31spring.mvc.view.expose-request-attributes配置是否将请求属性暴露给视图层
32spring.mvc.view.expose-session-attributes配置是否将会话属性暴露给视图层
33spring.mvc.view.expose-context-beans-as-attributes配置是否将Spring上下文中的Bean暴露给视图层
34spring.mvc.view.expose-bean-names配置暴露给视图层的Bean名称
35spring.mvc.default-redirect-attributes.enabled启用或禁用默认重定向的属性支持
36spring.mvc.deferred-result.timeout配置 DeferredResult 处理异步请求的超时时间
37spring.mvc.responsebodyadvice.enabled启用或禁用全局 @ResponseBodyAdvice 的支持
38spring.mvc.view.controllers.*配置静态控制器的映射路径
39spring.mvc.template.cache配置模板引擎的缓存策略(如 Thymeleaf 的视图缓存)
40spring.mvc.template.prefix配置模板视图解析器的前缀
41spring.mvc.template.suffix配置模板视图解析器的后缀
42spring.mvc.template.mode配置模板视图解析器的模式(如 HTML, XML
43spring.mvc.static-resource-locations配置静态资源的位置列表
44spring.mvc.webjars-locations配置WebJars资源的位置列表
45spring.mvc.filters.order配置全局过滤器的顺序
46spring.mvc.filters.dispatcher-types配置全局过滤器的 DispatcherType
47spring.mvc.websocket.enabled启用或禁用WebSocket的支持
48spring.mvc.multipart.enabled启用或禁用文件上传的支持
49spring.mvc.multipart.max-file-size配置单个文件上传的最大大小
50spring.mvc.multipart.max-request-size配置整个请求的最大大小(包括所有文件)

这份表格列出了 Spring Boot 中常见的 Spring MVC 配置属性,涵盖了视图解析、静态资源处理、内容协商、异步请求、URL路径匹配等多个方面。通过这些配置,开发者可以定制 Spring MVC 的行为,满足应用程序的需求。

六、JPA 配置属性表格:

序号配置属性描述
1spring.jpa.database配置目标数据库类型(如 mysql, postgresql
2spring.jpa.database-platform配置特定数据库平台的方言(如 org.hibernate.dialect.MySQL5Dialect
3spring.jpa.show-sql是否显示SQL语句(truefalse
4spring.jpa.hibernate.ddl-auto配置自动DDL操作(如 none, update, create, create-drop
5spring.jpa.properties.*配置传递给 JPA 实现的自定义属性
6spring.jpa.generate-ddl是否生成DDL(数据库结构)
7spring.jpa.open-in-view启用或禁用 OpenEntityManagerInView 过滤器,避免懒加载异常
8spring.jpa.defer-datasource-initialization是否在数据源初始化后再初始化 JPA
9spring.jpa.properties.hibernate.dialect配置 Hibernate 的方言(类似于 spring.jpa.database-platform
10spring.jpa.properties.hibernate.show_sql配置 Hibernate 显示 SQL 语句
11spring.jpa.properties.hibernate.format_sql配置 Hibernate 格式化 SQL 语句
12spring.jpa.properties.hibernate.use_sql_comments配置是否使用SQL注释
13spring.jpa.hibernate.naming.physical-strategy配置 Hibernate 的物理命名策略
14spring.jpa.hibernate.naming.implicit-strategy配置 Hibernate 的隐式命名策略
15spring.jpa.hibernate.use-new-id-generator-mappings是否使用新的ID生成器映射规则(默认 true
16spring.jpa.hibernate.cache.use_second_level_cache启用或禁用二级缓存
17spring.jpa.hibernate.cache.use_query_cache启用或禁用查询缓存
18spring.jpa.hibernate.cache.region.factory_class配置缓存区域工厂类(如 org.hibernate.cache.ehcache.EhCacheRegionFactory
19spring.jpa.hibernate.cache.region_prefix配置缓存区域前缀
20spring.jpa.hibernate.jdbc.batch_size配置批量插入时的批处理大小
21spring.jpa.hibernate.jdbc.fetch_size配置批量提取时的提取大小
22spring.jpa.hibernate.max_fetch_depth配置最大抓取深度
23spring.jpa.hibernate.cache.provider_class配置缓存提供者类
24spring.jpa.hibernate.enable_lazy_load_no_trans启用或禁用非事务性延迟加载
25spring.jpa.hibernate.bytecode.use_reflection_optimizer启用或禁用字节码优化
26spring.jpa.hibernate.default_batch_fetch_size配置默认的批量抓取大小
27spring.jpa.hibernate.order_inserts启用或禁用插入排序优化
28spring.jpa.hibernate.order_updates启用或禁用更新排序优化
29spring.jpa.hibernate.batch_versioned_data是否允许批量操作版本化数据
30spring.jpa.entity.scan.packages配置 JPA 扫描的实体包路径
31spring.jpa.properties.javax.persistence.sharedCache.mode配置 JPA 缓存共享模式(如 ENABLE_SELECTIVE, DISABLE_SELECTIVE
32spring.jpa.properties.javax.persistence.validation.mode配置 JPA 验证模式(如 AUTO, CALLBACK, NONE
33spring.jpa.properties.hibernate.hbm2ddl.charset_name配置生成DDL时使用的字符集
34spring.jpa.properties.hibernate.dialect.storage_engine配置数据库存储引擎(如 innodb,适用于 MySQL)
35spring.jpa.properties.hibernate.search.enabled启用或禁用Hibernate搜索功能
36spring.jpa.properties.hibernate.search.default.directory_provider配置Hibernate搜索的默认目录提供者
37spring.jpa.properties.hibernate.search.indexing_strategy配置索引策略(如 event, manual
38spring.jpa.query.timeout配置查询的超时时间(以秒为单位)
39spring.jpa.query.hints.*配置查询的提示信息
40spring.jpa.mapping-resources配置 XML 映射文件的路径
41spring.jpa.entity-manager.factory-class配置自定义的实体管理器工厂类
42spring.jpa.persistence-unit-name配置 JPA 持久化单元的名称
43spring.jpa.open-session-in-view启用或禁用视图中的Session(Hibernate 专用)
44spring.jpa.load-time-weaver启用或禁用JPA的加载时编织功能
45spring.jpa.properties.hibernate.jdbc.time_zone配置数据库连接时使用的时区
46spring.jpa.sql-load-script配置SQL加载脚本的路径
47spring.jpa.script.schema配置用于初始化数据库架构的SQL脚本
48spring.jpa.script.data配置用于初始化数据库数据的SQL脚本
49spring.jpa.hibernate.cache.use_structured_entries启用或禁用结构化缓存条目
50spring.jpa.metadata.provider配置元数据提供者(如 metadata-provider, metadata-extractor

这份表格列出了 Spring Boot 中常见的 JPA 配置属性,涵盖了 Hibernate 相关的属性、自定义方言、SQL显示选项、DDL生成、缓存配置等多个方面。开发者可以根据需要定制 JPA 行为,满足不同数据库和性能需求。

七、MyBatis 配置属性表格:

序号配置属性描述
1mybatis.config-location指定 MyBatis 全局配置文件的路径(如 classpath:mybatis-config.xml
2mybatis.mapper-locations指定 MyBatis Mapper 文件的位置(如 classpath*:mapper/**/*.xml
3mybatis.type-aliases-package配置别名的包路径(即实体类的包路径,以便在XML中不用写全类名)
4mybatis.type-handlers-package配置类型处理器的包路径
5mybatis.type-aliases-super-type指定某个父类或接口的所有子类作为 MyBatis 的别名类型
6mybatis.check-config-location是否检查 MyBatis 配置文件的位置
7mybatis.executor-type配置 MyBatis 执行器类型(如 SIMPLE, REUSE, BATCH
8mybatis.default-scripting-language-driver配置默认的脚本语言驱动类型
9mybatis.default-enum-type-handler配置默认的枚举类型处理器
10mybatis.configuration.*传递 MyBatis 自定义的配置属性
11mybatis.configuration.cache-enabled是否启用二级缓存(默认为 true
12mybatis.configuration.lazy-loading-enabled是否启用懒加载(默认为 false
13mybatis.configuration.aggressive-lazy-loading是否启用积极的懒加载(默认为 true
14mybatis.configuration.use-generated-keys是否允许 JDBC 支持生成主键(默认为 false
15mybatis.configuration.default-fetch-size配置默认的批量抓取大小
16mybatis.configuration.default-statement-timeout配置默认的语句超时时间(以秒为单位)
17mybatis.configuration.map-underscore-to-camel-case是否将数据库的下划线字段映射为驼峰命名的属性(如 user_name -> userName
18mybatis.configuration.safe-row-bounds-enabled是否启用安全的 RowBounds 使用
19mybatis.configuration.safe-result-handler-enabled是否启用安全的结果处理器使用
20mybatis.configuration.auto-mapping-behavior配置自动映射行为(如 PARTIAL, FULL
21mybatis.configuration.auto-mapping-unknown-column-behavior配置当映射未知列时的行为(如 NONE, WARNING, FAILING
22mybatis.configuration.local-cache-scope配置本地缓存作用域(如 SESSION, STATEMENT
23mybatis.configuration.jdbc-type-for-null配置当遇到 null 值时的 JDBC 类型(如 NULL, VARCHAR
24mybatis.configuration.lazy-load-trigger-methods配置懒加载时触发的类方法列表
25mybatis.configuration.log-impl配置日志实现(如 SLF4J, LOG4J2
26mybatis.configuration.proxy-factory配置代理工厂(如 JAVASSIST, CGLIB
27mybatis.configuration.default-result-set-type配置默认的结果集类型(如 FORWARD_ONLY, SCROLL_SENSITIVE
28mybatis.configuration.use-actual-param-name是否启用实际参数名称(默认为 true
29mybatis.configuration.return-instance-for-empty-row配置在结果集中没有数据时是否返回对象实例
30mybatis.configuration.log-prefix配置日志输出前缀
31mybatis.configuration.call-setters-on-nulls是否在 null 值时调用 setter 方法
32mybatis.configuration.use-column-label是否使用列标签代替列名
33mybatis.configuration.default-sql-provider-type配置默认的 SQL 提供者类型
34mybatis.configuration.use-discriminator-column-omitted-mappings是否启用忽略鉴别器列的映射
35mybatis.mapper-interfaces配置 MyBatis Mapper 接口的位置(通常与 @MapperScan 注解配合使用)
36mybatis.configuration.use-deprecated-executor是否启用已废弃的执行器
37mybatis.configuration.multiple-result-sets-enabled是否启用多结果集支持
38mybatis.configuration.max-result-cache-size配置结果缓存的最大大小
39mybatis.configuration.default-enum-type-handler配置默认的枚举类型处理器
40mybatis.configuration.property用于设置额外的 MyBatis 自定义属性
41mybatis.configuration.result-handlers-enabled是否启用结果处理器
42mybatis.configuration.cache-mapper-annotated-queries是否缓存使用 @Select 等注解定义的查询

这些 MyBatis 配置属性涵盖了 MyBatis 全局配置文件路径、Mapper 扫描路径、懒加载、二级缓存、SQL 映射行为等多个方面。开发者可以根据需要定制 MyBatis 的行为,满足应用程序中的数据访问需求。

  • 21
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

golove666

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值