diff --git a/pom.xml b/pom.xml index 947b4ec441..91d7abd5ca 100644 --- a/pom.xml +++ b/pom.xml @@ -131,6 +131,7 @@ spring-amqp-simple spring-apache-camel spring-batch + spring-bom spring-boot spring-cloud-data-flow spring-cloud diff --git a/spring-bom/README.md b/spring-bom/README.md new file mode 100644 index 0000000000..10e3502d11 --- /dev/null +++ b/spring-bom/README.md @@ -0,0 +1,3 @@ + +### Relevant Articles: +- [Spring with Maven BOM] diff --git a/spring-bom/pom.xml b/spring-bom/pom.xml new file mode 100644 index 0000000000..306632eb21 --- /dev/null +++ b/spring-bom/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + com.baeldung + spring-bom + 1.0.0-SNAPSHOT + spring-bom + http://maven.apache.org + + UTF-8 + + + + + org.springframework + spring-framework-bom + 4.3.8.RELEASE + pom + import + + + + + + org.springframework + spring-context + + + org.springframework + spring-web + + + diff --git a/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldApp.java b/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldApp.java new file mode 100644 index 0000000000..7c1e7f7c1d --- /dev/null +++ b/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldApp.java @@ -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()); + } + +} diff --git a/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldBean.java b/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldBean.java new file mode 100644 index 0000000000..f51b150f0a --- /dev/null +++ b/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldBean.java @@ -0,0 +1,8 @@ +package com.baeldung.spring.bom; + +public class HelloWorldBean { + + public String sayHello() { + return "Hello World With Maven BOM"; + } +} diff --git a/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldConfig.java b/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldConfig.java new file mode 100644 index 0000000000..8dc0e2c806 --- /dev/null +++ b/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldConfig.java @@ -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(); + } +}