Java Code Examples for org.springframework.context.ConfigurableApplicationContext#getBeanDefinitionNames()
The following examples show how to use
org.springframework.context.ConfigurableApplicationContext#getBeanDefinitionNames() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringBootDemoLogbackApplication.java From spring-boot-demo with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(SpringBootDemoLogbackApplication.class, args); int length = context.getBeanDefinitionNames().length; log.trace("Spring boot启动初始化了 {} 个 Bean", length); log.debug("Spring boot启动初始化了 {} 个 Bean", length); log.info("Spring boot启动初始化了 {} 个 Bean", length); log.warn("Spring boot启动初始化了 {} 个 Bean", length); log.error("Spring boot启动初始化了 {} 个 Bean", length); try { int i = 0; int j = 1 / i; } catch (Exception e) { log.error("【SpringBootDemoLogbackApplication】启动异常:", e); } }
Example 2
Source File: SpringBootDemoLogbackApplication.java From spring-boot-demo with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(SpringBootDemoLogbackApplication.class, args); int length = context.getBeanDefinitionNames().length; log.trace("Spring boot启动初始化了 {} 个 Bean", length); log.debug("Spring boot启动初始化了 {} 个 Bean", length); log.info("Spring boot启动初始化了 {} 个 Bean", length); log.warn("Spring boot启动初始化了 {} 个 Bean", length); log.error("Spring boot启动初始化了 {} 个 Bean", length); try { int i = 0; int j = 1 / i; } catch (Exception e) { log.error("【SpringBootDemoLogbackApplication】启动异常:", e); } }
Example 3
Source File: BlogmaniaApplication.java From Spring-Boot-2-Fundamentals with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(BlogmaniaApplication.class, args); for (String s : context.getBeanDefinitionNames()) { System.out.println(s); } //Alternatively for sorted output // Arrays.stream(context.getBeanDefinitionNames()) // .sorted() // .forEach(System.out::println); }
Example 4
Source File: BlogmaniaApplication.java From Spring-Boot-2-Fundamentals with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(BlogmaniaApplication.class, args); for (String s : context.getBeanDefinitionNames()) { System.out.println(s); } //Alternatively for sorted output // Arrays.stream(context.getBeanDefinitionNames()) // .sorted() // .forEach(System.out::println); }
Example 5
Source File: BlogmaniaApplication.java From Spring-Boot-2-Fundamentals with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(BlogmaniaApplication.class, args); for (String s : context.getBeanDefinitionNames()) { System.out.println(s); } //Alternatively for sorted output // Arrays.stream(context.getBeanDefinitionNames()) // .sorted() // .forEach(System.out::println); }
Example 6
Source File: BlogmaniaApplication.java From Spring-Boot-2-Fundamentals with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(BlogmaniaApplication.class, args); for (String s : context.getBeanDefinitionNames()) { System.out.println(s); } //Alternatively for sorted output // Arrays.stream(context.getBeanDefinitionNames()) // .sorted() // .forEach(System.out::println); }
Example 7
Source File: BlogmaniaApplication.java From Spring-Boot-2-Fundamentals with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(BlogmaniaApplication.class, args); for (String s : context.getBeanDefinitionNames()) { System.out.println(s); } //Alternatively for sorted output // Arrays.stream(context.getBeanDefinitionNames()) // .sorted() // .forEach(System.out::println); }
Example 8
Source File: BlogmaniaApplication.java From Spring-Boot-2-Fundamentals with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(BlogmaniaApplication.class, args); for (String s : context.getBeanDefinitionNames()) { System.out.println(s); } //Alternatively for sorted output // Arrays.stream(context.getBeanDefinitionNames()) // .sorted() // .forEach(System.out::println); }
Example 9
Source File: BlogmaniaApplication.java From Spring-Boot-2-Fundamentals with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(BlogmaniaApplication.class, args); List<BeanData> beans = new ArrayList<>(); for (String s : context.getBeanDefinitionNames()) { System.out.println(s); beans.add(new BeanData(s, context.getBean(s).getClass().getCanonicalName())); } //Alternative implementation using streams // List<BeanData> beans = Arrays.stream(context.getBeanDefinitionNames()) // .sorted() // .peek(System.out::println) // .map(s->new BeanData(s, context.getBean(s).getClass().getCanonicalName())) // .collect( Collectors.toList()); System.out.println(); System.out.println("### BeanData ###"); System.out.println(); for (BeanData bean : beans) { System.out.println(bean.getBean()+": "+bean.getBeanClass()); //You can also try the toString implementation that @Data provides: //System.out.println(bean); } //Alternative implementation using streams // beans.stream() // .map(bean -> bean.getBean()+": "+bean.getBeanClass()) // .forEach(System.out::println); }
Example 10
Source File: SpringBootDemoLogbackApplication.java From spring-boot-demo with MIT License | 5 votes |
public static void main(String[] args) { ConfigurableApplicationContext context = SpringApplication.run(SpringBootDemoLogbackApplication.class, args); int length = context.getBeanDefinitionNames().length; log.trace("Spring boot启动初始化了 {} 个 Bean", length); log.debug("Spring boot启动初始化了 {} 个 Bean", length); log.info("Spring boot启动初始化了 {} 个 Bean", length); log.warn("Spring boot启动初始化了 {} 个 Bean", length); log.error("Spring boot启动初始化了 {} 个 Bean", length); try { int i = 0; int j = 1 / i; } catch (Exception e) { log.error("【SpringBootDemoLogbackApplication】启动异常:", e); } }
Example 11
Source File: ApplicationTest.java From NFVO with Apache License 2.0 | 4 votes |
/** Main method for testing if the context contains all the needed beans */ public static void main(String[] argv) { ConfigurableApplicationContext context = SpringApplication.run(ApplicationTest.class); for (String s : context.getBeanDefinitionNames()) System.out.println(s); }
Example 12
Source File: ApplicationTest.java From NFVO with Apache License 2.0 | 4 votes |
public static void main(String[] argv) { ConfigurableApplicationContext context = SpringApplication.run(ApplicationTest.class); for (String s : context.getBeanDefinitionNames()) System.out.println(s); }
Example 13
Source File: TestMonitoringFilter.java From javamelody with Apache License 2.0 | 4 votes |
/** Test. * @throws ServletException e * @throws IOException e */ @Test public void testDoMonitoringWithPartsForSystemActions() throws ServletException, IOException { final Map<HttpParameter, String> parameters = new HashMap<HttpParameter, String>(); setProperty(Parameter.SYSTEM_ACTIONS_ENABLED, TRUE); parameters.put(HttpParameter.PART, HttpPart.PROCESSES.getName()); monitoring(parameters); monitorJdbcParts(parameters); // il ne faut pas faire un heapHisto sans thread comme dans TestHtmlHeapHistogramReport // parameters.put(HttpParameter.PART, HttpPart.HEAP_HISTO.getName()); // monitoring(parameters); monitoringSessionsPart(parameters); parameters.put(HttpParameter.PART, HttpPart.WEB_XML.getName()); monitoring(parameters, false); parameters.put(HttpParameter.PART, HttpPart.POM_XML.getName()); monitoring(parameters, false); parameters.put(HttpParameter.PART, HttpPart.JNDI.getName()); monitoring(parameters); parameters.put(HttpParameter.PART, HttpPart.MBEANS.getName()); monitoring(parameters); final ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( new String[] { "net/bull/javamelody/monitoring-spring.xml", }); try { context.getBeanDefinitionNames(); parameters.put(HttpParameter.PART, HttpPart.SPRING_BEANS.getName()); monitoring(parameters); setProperty(Parameter.SAMPLING_SECONDS, "60"); setUp(); parameters.put(HttpParameter.PART, HttpPart.HOTSPOTS.getName()); monitoring(parameters); parameters.remove(HttpParameter.PART); parameters.put(HttpParameter.JMX_VALUE, "java.lang:type=OperatingSystem.ProcessCpuTime"); monitoring(parameters); parameters.remove(HttpParameter.JMX_VALUE); parameters.put(HttpParameter.PART, HttpPart.HASH_PASSWORD.getName()); monitoring(parameters); parameters.put(HttpParameter.ALGORITHM, "SHA-256"); parameters.put(HttpParameter.REQUEST, "password"); monitoring(parameters); parameters.remove(HttpParameter.ALGORITHM); parameters.remove(HttpParameter.REQUEST); } finally { context.close(); } }