comparison spring-boot-playground/src/main/java/de/comline/spring/application/AutoConfiguredApplication.java @ 4:92d52e4ac567

JPA hinzugefuegt.
author Dirk Olmes <dirk.olmes@codedo.de>
date Thu, 13 Aug 2020 15:31:38 +0200
parents spring-boot-playground/src/main/java/de/comline/spring/application/Application.java@b4221c1389af
children 0c3494137a82
comparison
equal deleted inserted replaced
3:b4221c1389af 4:92d52e4ac567
1 package de.comline.spring.application;
2
3 import java.util.Arrays;
4
5 import org.springframework.boot.CommandLineRunner;
6 import org.springframework.boot.SpringApplication;
7 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
8 import org.springframework.boot.autoconfigure.domain.EntityScan;
9 import org.springframework.context.ApplicationContext;
10 import org.springframework.context.annotation.Bean;
11 import org.springframework.context.annotation.ComponentScan;
12 import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
13
14 @ComponentScan(basePackages = {
15 "de.comline.spring.controller",
16 "de.comline.spring.service"
17 })
18 @EnableAutoConfiguration
19 @EnableJpaRepositories("de.comline.spring.repository")
20 @EntityScan("de.comline.spring.entity")
21 public class AutoConfiguredApplication {
22 public static void main(String[] args) {
23 SpringApplication.run(AutoConfiguredApplication.class, args);
24 }
25
26 @Bean
27 public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
28 return args -> {
29 System.out.println("Let's inspect the beans provided by Spring Boot:");
30
31 String[] beanNames = ctx.getBeanDefinitionNames();
32 Arrays.sort(beanNames);
33 for (String beanName : beanNames) {
34 System.out.println(beanName);
35 }
36 };
37 }
38 }