Created
August 28, 2025 20:15
-
-
Save adbourne/d44c23aa44284c7fbb1f7d6a2af718ff to your computer and use it in GitHub Desktop.
Log out beans
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** Do not use in prod */ | |
| package com.devtiro.secureweb; | |
| import jakarta.annotation.PostConstruct; | |
| import org.springframework.beans.factory.annotation.Autowired; | |
| import org.springframework.boot.SpringApplication; | |
| import org.springframework.boot.autoconfigure.SpringBootApplication; | |
| import org.springframework.context.ApplicationContext; | |
| import java.util.Arrays; | |
| @SpringBootApplication | |
| public class SecurewebApplication { | |
| @Autowired | |
| private ApplicationContext applicationContext; | |
| public static void main(String[] args) { | |
| SpringApplication.run(SecurewebApplication.class, args); | |
| } | |
| @PostConstruct | |
| public void printBeans() { | |
| String[] beanNames = applicationContext.getBeanDefinitionNames(); | |
| System.out.println("Loaded beans count: " + beanNames.length); | |
| Arrays.stream(beanNames) | |
| .sorted() | |
| .forEach(System.out::println); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment