Spring With Maven BOM (#2121)

* Spring With Maven BOM

* change xml indentation to spaces
This commit is contained in:
shaimaa-hshalaby 2017-06-24 08:04:09 +02:00 committed by Grzegorz Piwowarek
parent f03ed8548b
commit 79c91fdb33
6 changed files with 79 additions and 0 deletions

View File

@ -131,6 +131,7 @@
<module>spring-amqp-simple</module>
<module>spring-apache-camel</module>
<module>spring-batch</module>
<module>spring-bom</module>
<module>spring-boot</module>
<module>spring-cloud-data-flow</module>
<module>spring-cloud</module>

3
spring-bom/README.md Normal file
View File

@ -0,0 +1,3 @@
### Relevant Articles:
- [Spring with Maven BOM]

40
spring-bom/pom.xml Normal file
View File

@ -0,0 +1,40 @@
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.baeldung</groupId>
<artifactId>spring-bom</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>spring-bom</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.3.8.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,14 @@
package com.baeldung.spring.bom;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class HelloWorldApp {
public static void main(String[] args) {
ApplicationContext ctx = new AnnotationConfigApplicationContext(HelloWorldConfig.class);
HelloWorldBean helloWorldBean = ctx.getBean(HelloWorldBean.class);
System.out.println(helloWorldBean.sayHello());
}
}

View File

@ -0,0 +1,8 @@
package com.baeldung.spring.bom;
public class HelloWorldBean {
public String sayHello() {
return "Hello World With Maven BOM";
}
}

View File

@ -0,0 +1,13 @@
package com.baeldung.spring.bom;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class HelloWorldConfig {
@Bean
public HelloWorldBean helloWorldBean() {
return new HelloWorldBean();
}
}