| 1 | package fr.sii.ogham.spring.v3.template; | |
| 2 | ||
| 3 | import fr.sii.ogham.spring.v3.template.thymeleaf.*; | |
| 4 | import org.springframework.beans.factory.annotation.Autowired; | |
| 5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | |
| 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | |
| 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnNotWebApplication; | |
| 8 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; | |
| 9 | import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties; | |
| 10 | import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
| 11 | import org.springframework.context.ApplicationContext; | |
| 12 | import org.springframework.context.annotation.Bean; | |
| 13 | import org.springframework.context.annotation.Configuration; | |
| 14 | import org.springframework.core.convert.ConversionService; | |
| 15 | import org.thymeleaf.spring6.expression.ThymeleafEvaluationContext; | |
| 16 | import org.thymeleaf.spring6.naming.SpringContextVariableNames; | |
| 17 | ||
| 18 | import fr.sii.ogham.spring.email.OghamEmailProperties; | |
| 19 | import fr.sii.ogham.spring.sms.OghamSmsProperties; | |
| 20 | import fr.sii.ogham.spring.template.OghamCommonTemplateProperties; | |
| 21 | import fr.sii.ogham.spring.template.OghamThymeleafProperties; | |
| 22 | import fr.sii.ogham.spring.template.ThymeLeafConfigurer; | |
| 23 | import fr.sii.ogham.spring.template.thymeleaf.ContextMerger; | |
| 24 | import fr.sii.ogham.spring.template.thymeleaf.SpringStandaloneThymeleafContextConverter; | |
| 25 | import fr.sii.ogham.spring.template.thymeleaf.SpringWebThymeleafContextConverter; | |
| 26 | import fr.sii.ogham.spring.template.thymeleaf.StaticVariablesProvider; | |
| 27 | import fr.sii.ogham.spring.template.thymeleaf.TemplateEngineSupplier; | |
| 28 | import fr.sii.ogham.spring.template.thymeleaf.ThymeleafEvaluationContextProvider; | |
| 29 | import fr.sii.ogham.spring.template.thymeleaf.WebContextProvider; | |
| 30 | import fr.sii.ogham.template.thymeleaf.common.SimpleThymeleafContextConverter; | |
| 31 | import fr.sii.ogham.template.thymeleaf.common.ThymeleafContextConverter; | |
| 32 | import fr.sii.ogham.template.thymeleaf.v3.buider.ThymeleafV3EmailBuilder; | |
| 33 | import fr.sii.ogham.template.thymeleaf.v3.buider.ThymeleafV3SmsBuilder; | |
| 34 | ||
| 35 | @Configuration | |
| 36 | @ConditionalOnClass({org.thymeleaf.spring6.SpringTemplateEngine.class, fr.sii.ogham.template.thymeleaf.v3.buider.ThymeleafV3EmailBuilder.class}) | |
| 37 | @EnableConfigurationProperties(OghamThymeleafProperties.class) | |
| 38 | public class OghamThymeleafSpring6Configuration { | |
| 39 | @Bean | |
| 40 | @ConditionalOnMissingBean(TemplateEngineSupplier.class) | |
| 41 | public TemplateEngineSupplier oghamTemplateEngineSupplier(@Autowired(required=false) org.thymeleaf.spring6.SpringTemplateEngine springTemplateEngine) { | |
| 42 |
2
1. oghamTemplateEngineSupplier : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::oghamTemplateEngineSupplier → KILLED 2. lambda$oghamTemplateEngineSupplier$0 : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::lambda$oghamTemplateEngineSupplier$0 → KILLED |
return () -> springTemplateEngine; |
| 43 | } | |
| 44 | ||
| 45 | @Bean | |
| 46 | @ConditionalOnMissingBean(ThymeleafContextConverter.class) | |
| 47 | @ConditionalOnNotWebApplication | |
| 48 | public ThymeleafContextConverter springStandaloneThymeleafContextConverter( | |
| 49 | StaticVariablesProvider staticVariablesProvider, | |
| 50 | ThymeleafEvaluationContextProvider thymeleafEvaluationContextProvider, | |
| 51 | ContextMerger contextMerger) { | |
| 52 |
1
1. springStandaloneThymeleafContextConverter : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::springStandaloneThymeleafContextConverter → KILLED |
return springThymeleafContextConverter(staticVariablesProvider, thymeleafEvaluationContextProvider, contextMerger); |
| 53 | } | |
| 54 | | |
| 55 | @Bean | |
| 56 | @ConditionalOnMissingBean(ThymeleafContextConverter.class) | |
| 57 | @ConditionalOnWebApplication | |
| 58 | public ThymeleafContextConverter springWebThymeleafContextConverter( | |
| 59 | StaticVariablesProvider staticVariablesProvider, | |
| 60 | ThymeleafEvaluationContextProvider thymeleafEvaluationContextProvider, | |
| 61 | ContextMerger contextMerger, | |
| 62 | ApplicationContext applicationContext, | |
| 63 | WebContextProvider webContextProvider, | |
| 64 | @Autowired(required=false) org.thymeleaf.spring6.SpringTemplateEngine springTemplateEngine) { | |
| 65 |
1
1. springWebThymeleafContextConverter : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::springWebThymeleafContextConverter → SURVIVED |
return new SpringWebThymeleafContextConverter( |
| 66 | springThymeleafContextConverter(staticVariablesProvider, thymeleafEvaluationContextProvider, contextMerger), | |
| 67 | SpringContextVariableNames.SPRING_REQUEST_CONTEXT, | |
| 68 | applicationContext, | |
| 69 | webContextProvider, | |
| 70 | new Spring6WebMvcThymeleafRequestContextWrapper(), | |
| 71 | new WebExpressionContextProvider(springTemplateEngine), | |
| 72 | contextMerger, | |
| 73 | new RequestContextProvider()); | |
| 74 | } | |
| 75 | | |
| 76 | @Bean | |
| 77 | @ConditionalOnWebApplication | |
| 78 | public WebContextProvider webContextProvider() { | |
| 79 |
1
1. webContextProvider : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::webContextProvider → SURVIVED |
return new RequestContextHolderWebContextProvider(); |
| 80 | } | |
| 81 | ||
| 82 | @Bean | |
| 83 | @ConditionalOnMissingBean(ThymeleafEvaluationContextProvider.class) | |
| 84 | public ThymeleafEvaluationContextProvider springThymeleafEvaluationContextProvider( | |
| 85 | OghamThymeleafProperties props, | |
| 86 | ApplicationContext applicationContext, | |
| 87 | @Autowired(required=false) ConversionService conversionService) { | |
| 88 |
1
1. springThymeleafEvaluationContextProvider : negated conditional → KILLED |
if (props.isEnableSpringBeans()) { |
| 89 |
2
1. lambda$springThymeleafEvaluationContextProvider$1 : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::lambda$springThymeleafEvaluationContextProvider$1 → KILLED 2. springThymeleafEvaluationContextProvider : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::springThymeleafEvaluationContextProvider → KILLED |
return c -> new ThymeleafEvaluationContext(applicationContext, conversionService); |
| 90 | } | |
| 91 |
1
1. springThymeleafEvaluationContextProvider : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::springThymeleafEvaluationContextProvider → NO_COVERAGE |
return c -> null; |
| 92 | } | |
| 93 | ||
| 94 | @Bean | |
| 95 | @ConditionalOnMissingBean(StaticVariablesProvider.class) | |
| 96 | public StaticVariablesProvider springThymeleafStaticVariablesProvider() { | |
| 97 |
2
1. lambda$springThymeleafStaticVariablesProvider$3 : replaced return value with Collections.emptyMap for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::lambda$springThymeleafStaticVariablesProvider$3 → SURVIVED 2. springThymeleafStaticVariablesProvider : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::springThymeleafStaticVariablesProvider → KILLED |
return c -> null; |
| 98 | } | |
| 99 | | |
| 100 | @Bean | |
| 101 | @ConditionalOnMissingBean(ContextMerger.class) | |
| 102 | public ContextMerger contextMerger() { | |
| 103 |
1
1. contextMerger : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::contextMerger → KILLED |
return new UpdateCurrentContextMerger(); |
| 104 | } | |
| 105 | ||
| 106 | @Bean | |
| 107 | @ConditionalOnMissingBean(ThymeLeafConfigurer.class) | |
| 108 | public ThymeLeafConfigurer thymeleafConfigurer( | |
| 109 | TemplateEngineSupplier springTemplateEngineSupplier, | |
| 110 | @Autowired(required=false) ThymeleafContextConverter contextConverter, | |
| 111 | @Autowired(required=false) OghamCommonTemplateProperties templateProperties, | |
| 112 | @Autowired(required=false) OghamEmailProperties emailProperties, | |
| 113 | @Autowired(required=false) OghamSmsProperties smsProperties, | |
| 114 | @Autowired(required=false) ThymeleafProperties thymeleafProperties) { | |
| 115 |
1
1. thymeleafConfigurer : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::thymeleafConfigurer → KILLED |
return new ThymeLeafConfigurer( |
| 116 | springTemplateEngineSupplier, | |
| 117 | contextConverter, | |
| 118 | templateProperties, | |
| 119 | emailProperties, | |
| 120 | smsProperties, | |
| 121 | thymeleafProperties, | |
| 122 | ThymeleafV3EmailBuilder.class, | |
| 123 | ThymeleafV3SmsBuilder.class); | |
| 124 | } | |
| 125 | ||
| 126 | private static SpringStandaloneThymeleafContextConverter springThymeleafContextConverter(StaticVariablesProvider staticVariablesProvider, | |
| 127 | ThymeleafEvaluationContextProvider thymeleafEvaluationContextProvider, ContextMerger contextMerger) { | |
| 128 |
1
1. springThymeleafContextConverter : replaced return value with null for fr/sii/ogham/spring/v3/template/OghamThymeleafSpring6Configuration::springThymeleafContextConverter → KILLED |
return new SpringStandaloneThymeleafContextConverter( |
| 129 | new SimpleThymeleafContextConverter(), | |
| 130 | ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME, | |
| 131 | staticVariablesProvider, | |
| 132 | thymeleafEvaluationContextProvider, | |
| 133 | contextMerger); | |
| 134 | } | |
| 135 | } | |
Mutations | ||
| 42 |
1.1 2.2 |
|
| 52 |
1.1 |
|
| 65 |
1.1 |
|
| 79 |
1.1 |
|
| 88 |
1.1 |
|
| 89 |
1.1 2.2 |
|
| 91 |
1.1 |
|
| 97 |
1.1 2.2 |
|
| 103 |
1.1 |
|
| 115 |
1.1 |
|
| 128 |
1.1 |