Spring With Maven BOM (#2121)
* Spring With Maven BOM * change xml indentation to spaces
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
f03ed8548b
commit
79c91fdb33
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.baeldung.spring.bom;
|
||||
|
||||
public class HelloWorldBean {
|
||||
|
||||
public String sayHello() {
|
||||
return "Hello World With Maven BOM";
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user