반응형
    
    
    
  
		                                        Notice
		                                        
										
                                    
                                    
                                        Recent Posts
                                        
                                    
                                    
                                        Recent Comments
                                        
                                    
                                    
                                        Link
                                        
                                    
                                | 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 | 
| 12 | 13 | 14 | 15 | 16 | 17 | 18 | 
| 19 | 20 | 21 | 22 | 23 | 24 | 25 | 
| 26 | 27 | 28 | 29 | 30 | 31 | 
                                        Tags
                                        
                                    
                                    - 문자열
- list
- 정규식
- CSS
- HashMap
- html
- Java
- js
- 배열
- IntelliJ
- javascript
- input
- replace
- Eclipse
- 자바
- date
- 이클립스
- Visual Studio Code
- vscode
- json
- table
- 이탈리아
- Button
- map
- CMD
- Array
- 인텔리제이
- ArrayList
- 자바스크립트
- string
                                        Archives
                                        
                                    
                                    - Today
- Total
어제 오늘 내일
[Spring] 등록 된 모든 Bean 목록 출력하기 본문
getBeanDefinitionNames()
ApplicationContext의 이 메소드는
ApplicationContext 안의 모든 Bean 이름을 배열로 리턴합니다.
이 메소드를 이용하여
등록된 모든 Bean의 목록을 출력할 수 있습니다.
@SpringBootApplication
public class HelloSpringApplication {
	private static ApplicationContext context;
	public static void main(String[] args) {
		context = SpringApplication.run(HelloSpringApplication.class, args);
		printBeanList();
	}
	public static void printBeanList() {
		String[] beans = context.getBeanDefinitionNames();
		for(String bean: beans)	{
			System.out.println("Bean Definition Name: " + bean);
		}
	}
}
결과
결과의 일부를 캡쳐하였습니다.
다음과 같이 등록 된 모든 Bean 이름이 출력됩니다.

반응형
    
    
    
  'IT > SpringBoot' 카테고리의 다른 글
| Liquibase checksum 오류가 발생하는 경우 (변경사항 없는 경우 포함) (1) | 2025.05.07 | 
|---|---|
| [SpringBoot] h2 db 설정, h2 콘솔 접속하기 (0) | 2024.05.04 | 
| [Spring Boot] @RequestParam 어노테이션 사용법 (0) | 2023.12.20 | 
| [Spring Boot / 에러] Name for argument of type [java.lang.String] not specified, and parameter name information not found in class file either (0) | 2023.12.19 | 
| [Spring Boot] 서버 포트 변경하기 (0) | 2023.06.25 | 
                              Comments
                            
                        
                    
                
                    
                
				
				
				
				
                
             
													