0
点赞
收藏
分享

微信扫一扫

Springboot注入第三方jar包,可以使用@Autowised

巧乐兹_d41f 2022-03-11 阅读 65

Springboot注入第三方jar包,可以使用@Autowired

// An highlighted block
@Autowired
private Cloner cloner;
import com.rits.cloning.Cloner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

@Configuration
public class CommonConfiguration {

    @Bean
    public Cloner cloner() {
        return new Cloner();
    }

    @Bean(name = "freeMarkerConfigure")
    public freemarker.template.Configuration freeMarkerConfigure() throws IOException {
        freemarker.template.Configuration configuration = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_28);
        configuration.setDefaultEncoding(StandardCharsets.UTF_8.name());
        configuration.setClassForTemplateLoading(this.getClass(), "/ftls");
        return configuration;
    }


}

举报

相关推荐

0 条评论