File tree Expand file tree Collapse file tree
src/main/java/com/baeldung/spring/bom Expand file tree Collapse file tree Original file line number Diff line number Diff line change 131131 <module >spring-amqp-simple</module >
132132 <module >spring-apache-camel</module >
133133 <module >spring-batch</module >
134+ <module >spring-bom</module >
134135 <module >spring-boot</module >
135136 <module >spring-cloud-data-flow</module >
136137 <module >spring-cloud</module >
Original file line number Diff line number Diff line change 1+
2+ ### Relevant Articles:
3+ - [ Spring with Maven BOM]
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <project
3+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
4+ xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" >
5+ <modelVersion >4.0.0</modelVersion >
6+ <parent >
7+ <groupId >com.baeldung</groupId >
8+ <artifactId >parent-modules</artifactId >
9+ <version >1.0.0-SNAPSHOT</version >
10+ </parent >
11+ <groupId >com.baeldung</groupId >
12+ <artifactId >spring-bom</artifactId >
13+ <version >1.0.0-SNAPSHOT</version >
14+ <name >spring-bom</name >
15+ <url >http://maven.apache.org</url >
16+ <properties >
17+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
18+ </properties >
19+ <dependencyManagement >
20+ <dependencies >
21+ <dependency >
22+ <groupId >org.springframework</groupId >
23+ <artifactId >spring-framework-bom</artifactId >
24+ <version >4.3.8.RELEASE</version >
25+ <type >pom</type >
26+ <scope >import</scope >
27+ </dependency >
28+ </dependencies >
29+ </dependencyManagement >
30+ <dependencies >
31+ <dependency >
32+ <groupId >org.springframework</groupId >
33+ <artifactId >spring-context</artifactId >
34+ </dependency >
35+ <dependency >
36+ <groupId >org.springframework</groupId >
37+ <artifactId >spring-web</artifactId >
38+ </dependency >
39+ </dependencies >
40+ </project >
Original file line number Diff line number Diff line change 1+ package com .baeldung .spring .bom ;
2+
3+ import org .springframework .context .ApplicationContext ;
4+ import org .springframework .context .annotation .AnnotationConfigApplicationContext ;
5+
6+ public class HelloWorldApp {
7+
8+ public static void main (String [] args ) {
9+ ApplicationContext ctx = new AnnotationConfigApplicationContext (HelloWorldConfig .class );
10+ HelloWorldBean helloWorldBean = ctx .getBean (HelloWorldBean .class );
11+ System .out .println (helloWorldBean .sayHello ());
12+ }
13+
14+ }
Original file line number Diff line number Diff line change 1+ package com .baeldung .spring .bom ;
2+
3+ public class HelloWorldBean {
4+
5+ public String sayHello () {
6+ return "Hello World With Maven BOM" ;
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ package com .baeldung .spring .bom ;
2+
3+ import org .springframework .context .annotation .Bean ;
4+ import org .springframework .context .annotation .Configuration ;
5+
6+ @ Configuration
7+ public class HelloWorldConfig {
8+
9+ @ Bean
10+ public HelloWorldBean helloWorldBean () {
11+ return new HelloWorldBean ();
12+ }
13+ }
You can’t perform that action at this time.
0 commit comments