码迷,mamicode.com
首页 > 编程语言 > 详细

Springboot Freemarker配置全局变量配置类

时间:2019-07-28 09:40:18      阅读:909      评论:0      收藏:0      [点我收藏+]

标签:configure   wired   pac   eem   framework   auto   --   全局   vax   


package com.xhd.read.config;

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

import javax.annotation.PostConstruct;

@Slf4j
@Configuration
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FreeMarkerConfig {
@Autowired
private freemarker.template.Configuration configuration;

@Value("${system.ctx}")
private String ctx;

@Value("${system.spath}")
private String spath;



@PostConstruct
public void setConfigure() throws Exception {

configuration.setSharedVariable("CPATH", ctx);
configuration.setSharedVariable("SPATH", spath);

}

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

Springboot Freemarker配置全局变量配置类

标签:configure   wired   pac   eem   framework   auto   --   全局   vax   

原文地址:https://www.cnblogs.com/liyanyan665/p/11257598.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!