Merge pull request #7278 from eugenp/BAEL-2940_component_scan

BAEL-2940 Update Spring ComponentScanning. Moved componentscan code t…
This commit is contained in:
Loredana Crusoveanu 2019-07-19 11:52:41 +03:00 committed by GitHub
commit d7d62646a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 69 additions and 8 deletions

View File

@ -835,7 +835,8 @@
<module>spring-boot-camel</module>
<module>spring-boot-client</module>
<module>spring-boot-custom-starter</module>
<module>greeter-spring-boot-autoconfigure</module>
<module>spring-boot-di</module>
<module>greeter-spring-boot-autoconfigure</module>
<module>greeter-spring-boot-sample-app</module>
<module>persistence-modules/spring-boot-h2/spring-boot-h2-database</module>
<module>spring-boot-jasypt</module>

55
spring-boot-di/pom.xml Normal file
View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-boot-mvc</artifactId>
<name>spring-boot-mvc</name>
<packaging>jar</packaging>
<description>Module For Spring Boot DI</description>
<parent>
<artifactId>parent-boot-2</artifactId>
<groupId>com.baeldung</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-boot-2</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.baeldung.SpringBootDiApplication</mainClass>
<layout>JAR</layout>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<start-class>com.baeldung.SpringBootDiApplication</start-class>
</properties>
</project>

View File

@ -0,0 +1,12 @@
package com.baeldung;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootDiApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootDiApplication.class, args);
}
}

View File

@ -1,10 +1,6 @@
package com.baeldung.componentscan.springapp;
import org.springframework.context.annotation.FilterType;
import org.springframework.stereotype.Component;
import com.baeldung.componentscan.ExampleBean;
import com.baeldung.componentscan.springapp.flowers.Rose;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

View File

@ -1,14 +1,11 @@
package com.baeldung.componentscan.springbootapp;
import org.springframework.boot.SpringApplication;
import org.springframework.context.annotation.FilterType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import com.baeldung.componentscan.ExampleBean;
import com.baeldung.componentscan.springbootapp.flowers.Rose;
@SpringBootApplication
//@ComponentScan(basePackages = "com.baeldung.componentscan.springbootapp.animals")