Springboot Freemarkerのは、グローバル変数の設定クラスを設定します


パッケージcom.xhd.read.config。

輸入lombok.AllArgsConstructor。
輸入lombok.Data。
輸入lombok.NoArgsConstructor。
輸入lombok.extern.slf4j.Slf4j。
輸入org.springframework.beans.factory.annotation.Autowired;
輸入org.springframework.beans.factory.annotation.Value。
輸入org.springframework.context.annotation.Configuration。

輸入javax.annotation.PostConstruct。

@ SLF4J
@Configuration
@Data
@NoArgsConstructor
@AllArgsConstructor
パブリッククラスFreeMarkerConfig {
@Autowired
プライベートfreemarker.template.Configuration構成。

@value( "$ {system.ctx}")
プライベート文字列CTX。

@value( "$ {system.spath}")
プライベート文字列SPATH。



@PostConstruct
公共ボイドsetConfigureを()は、例外{スロー

configuration.setSharedVariable( "CPATH"、CTX)。
configuration.setSharedVariable( "SPATH"、SPATH)。

}

}
 
---------------------

おすすめ

転載: www.cnblogs.com/liyanyan665/p/11257598.html
おすすめ