Add nullability annotations to module/spring-boot-thymeleaf

See gh-46587
This commit is contained in:
Moritz Halbritter
2025-08-06 10:29:36 +02:00
parent f52c8822d0
commit e27009d185
2 changed files with 23 additions and 18 deletions
@@ -20,6 +20,8 @@ import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.List;
import org.jspecify.annotations.Nullable;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.http.MediaType;
import org.springframework.util.MimeType;
@@ -83,17 +85,17 @@ public class ThymeleafProperties {
* first in the chain. Order start at 1 and should only be set if you have defined
* additional "TemplateResolver" beans.
*/
private Integer templateResolverOrder;
private @Nullable Integer templateResolverOrder;
/**
* List of view names (patterns allowed) that can be resolved.
*/
private String[] viewNames;
private String @Nullable [] viewNames;
/**
* List of view names (patterns allowed) that should be excluded from resolution.
*/
private String[] excludedViewNames;
private String @Nullable [] excludedViewNames;
/**
* Enable the SpringEL compiler in SpringEL expressions.
@@ -179,27 +181,27 @@ public class ThymeleafProperties {
this.cache = cache;
}
public Integer getTemplateResolverOrder() {
public @Nullable Integer getTemplateResolverOrder() {
return this.templateResolverOrder;
}
public void setTemplateResolverOrder(Integer templateResolverOrder) {
public void setTemplateResolverOrder(@Nullable Integer templateResolverOrder) {
this.templateResolverOrder = templateResolverOrder;
}
public String[] getExcludedViewNames() {
public String @Nullable [] getExcludedViewNames() {
return this.excludedViewNames;
}
public void setExcludedViewNames(String[] excludedViewNames) {
public void setExcludedViewNames(String @Nullable [] excludedViewNames) {
this.excludedViewNames = excludedViewNames;
}
public String[] getViewNames() {
public String @Nullable [] getViewNames() {
return this.viewNames;
}
public void setViewNames(String[] viewNames) {
public void setViewNames(String @Nullable [] viewNames) {
this.viewNames = viewNames;
}
@@ -269,25 +271,25 @@ public class ThymeleafProperties {
/**
* Media types supported by the view technology.
*/
private List<MediaType> mediaTypes;
private @Nullable List<MediaType> mediaTypes;
/**
* Comma-separated list of view names (patterns allowed) that should be executed
* in FULL mode even if a max chunk size is set.
*/
private String[] fullModeViewNames;
private String @Nullable [] fullModeViewNames;
/**
* Comma-separated list of view names (patterns allowed) that should be the only
* ones executed in CHUNKED mode when a max chunk size is set.
*/
private String[] chunkedModeViewNames;
private String @Nullable [] chunkedModeViewNames;
public List<MediaType> getMediaTypes() {
public @Nullable List<MediaType> getMediaTypes() {
return this.mediaTypes;
}
public void setMediaTypes(List<MediaType> mediaTypes) {
public void setMediaTypes(@Nullable List<MediaType> mediaTypes) {
this.mediaTypes = mediaTypes;
}
@@ -299,19 +301,19 @@ public class ThymeleafProperties {
this.maxChunkSize = maxChunkSize;
}
public String[] getFullModeViewNames() {
public String @Nullable [] getFullModeViewNames() {
return this.fullModeViewNames;
}
public void setFullModeViewNames(String[] fullModeViewNames) {
public void setFullModeViewNames(String @Nullable [] fullModeViewNames) {
this.fullModeViewNames = fullModeViewNames;
}
public String[] getChunkedModeViewNames() {
public String @Nullable [] getChunkedModeViewNames() {
return this.chunkedModeViewNames;
}
public void setChunkedModeViewNames(String[] chunkedModeViewNames) {
public void setChunkedModeViewNames(String @Nullable [] chunkedModeViewNames) {
this.chunkedModeViewNames = chunkedModeViewNames;
}
@@ -17,4 +17,7 @@
/**
* Auto-configuration for Thymeleaf.
*/
@NullMarked
package org.springframework.boot.thymeleaf.autoconfigure;
import org.jspecify.annotations.NullMarked;