---
title: "Comment by Donnie on \"Hướng dẫn tích hợp Groovy Script vào Spring boot project.\" | Hashnode"
description: "Cách khác: dùng Bean Factory for (String beanName : beanNames) { if (beanFactory.containsBean(beanName)) { binding.setVariable(beanName, beanFactory.getBean(bea"
url: "https://hashnode.com/posts/huong-dan-tich-hop-groovy-script-vao-spring-boot-project/6507d3f229ff3e29141b4234/comment/6507d44c95e1a9033f227cd2"
---

[Discussion](https://hashnode.com/posts/huong-dan-tich-hop-groovy-script-vao-spring-boot-project/6507d3f229ff3e29141b4234)

Comment [Hướng dẫn tích hợp Groovy Script vào Spring boot project.](https://hashnode.com/posts/huong-dan-tich-hop-groovy-script-vao-spring-boot-project/6507d3f229ff3e29141b4234)

[Donnie](https://hashnode.com/@technicaldeepdive)

[Sep 18, 2023](https://hashnode.com/posts/huong-dan-tich-hop-groovy-script-vao-spring-boot-project/6507d3f229ff3e29141b4234/comment/6507d44c95e1a9033f227cd2)

Cách khác: dùng Bean Factory for (String beanName : beanNames) { if (beanFactory.containsBean(beanName)) { binding.setVariable(beanName, beanFactory.getBean(beanName)); } } hoặc lấy all bean: @Autowired private ApplicationContext applicationContext;

private Binding getBeansBinding() { Binding binding = new Binding(); String\[\] beanNames = applicationContext.getBeanDefinitionNames(); for (String beanName : beanNames) { binding.setVariable(beanName, applicationContext.getBean(beanName)); } return binding; }
