Springboot注入第三方jar包,可以使用@Autowised
    
 
Springboot注入第三方jar包,可以使用@Autowired
 
 
@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;
    }
}