반응형
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 |
Tags
- CMD
- js
- Java
- 자바스크립트
- Eclipse
- 자바
- input
- ArrayList
- string
- table
- list
- Button
- 인텔리제이
- 이클립스
- 문자열
- windows
- 배열
- Array
- CSS
- vscode
- date
- html
- Maven
- json
- Visual Studio Code
- javascript
- 이탈리아
- 테이블
- IntelliJ
- 정규식
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' 카테고리의 다른 글
[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 |
[SpringBoot] SpringBoot 특징 (0) | 2021.10.04 |