File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 262262 <module >java-spi</module >
263263 <module >performance-tests</module >
264264 <module >twilio</module >
265- <module >java-ee-8-security-api</module >
266- <module >spring-webflux-amqp</module >
265+ <module >spring-boot-ctx-fluent</module >
266+ <module >java-ee-8-security-api</module >
267+ <module >spring-webflux-amqp</module >
267268 </modules >
268269
269270 <dependencies >
Original file line number Diff line number Diff line change 33 <modelVersion >4.0.0</modelVersion >
44
55 <groupId >com.baeldung</groupId >
6- <artifactId >ctxexample </artifactId >
6+ <artifactId >spring-boot-ctx-fluent </artifactId >
77 <version >0.0.1-SNAPSHOT</version >
88 <packaging >jar</packaging >
99
10- <name >ctxexample</name >
11- <url >http://maven.apache.org</url >
10+ <parent >
11+ <artifactId >parent-boot-2</artifactId >
12+ <groupId >com.baeldung</groupId >
13+ <version >0.0.1-SNAPSHOT</version >
14+ <relativePath >../parent-boot-2</relativePath >
15+ </parent >
1216
13- <properties >
14- <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
15- </properties >
16- <parent >
17- <groupId >org.springframework.boot</groupId >
18- <artifactId >spring-boot-starter-parent</artifactId >
19- <version >2.0.0.RELEASE</version >
20- </parent >
2117 <dependencies >
2218 <dependency >
2319 <groupId >org.springframework.boot</groupId >
2420 <artifactId >spring-boot-starter-web</artifactId >
2521 </dependency >
2622 </dependencies >
23+
24+ <properties >
25+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
26+ </properties >
27+
2728</project >
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1- package com .baeldung .web ;
1+ package com .baeldung .ctx1 ;
22
33import org .springframework .boot .autoconfigure .EnableAutoConfiguration ;
44import org .springframework .context .annotation .Bean ;
55import org .springframework .context .annotation .ComponentScan ;
66import org .springframework .context .annotation .Configuration ;
77import org .springframework .context .annotation .PropertySource ;
88
9- import com .baeldung .services .IHomeService ;
9+ import com .baeldung .parent .IHomeService ;
1010
1111@ Configuration
12- @ ComponentScan ("com.baeldung.web" )
12+ @ ComponentScan ("com.baeldung.ctx1" )
13+ @ PropertySource ("classpath:ctx1.properties" )
1314@ EnableAutoConfiguration
14- @ PropertySource ("classpath:web-app.properties" )
15- public class WebConfig {
15+ public class Ctx1Config {
1616
1717 @ Bean
1818 public IHomeService homeService () {
1919 return new GreetingService ();
2020 }
21+
2122}
Original file line number Diff line number Diff line change 1- package com .baeldung .web ;
1+ package com .baeldung .ctx1 ;
22
33import org .springframework .beans .factory .annotation .Autowired ;
44import org .springframework .stereotype .Controller ;
55import org .springframework .web .bind .annotation .GetMapping ;
66import org .springframework .web .bind .annotation .ResponseBody ;
77
8- import com .baeldung .services .IHomeService ;
8+ import com .baeldung .parent .IHomeService ;
99
1010@ Controller
11- public class HomeController {
11+ public class Ctx1Controller {
1212
1313 @ Autowired
1414 IHomeService homeService ;
Original file line number Diff line number Diff line change 1- package com .baeldung .web ;
1+ package com .baeldung .ctx1 ;
22
33import org .springframework .stereotype .Service ;
44
5- import com .baeldung .services .IHomeService ;
5+ import com .baeldung .parent .IHomeService ;
66
77@ Service
88public class GreetingService implements IHomeService {
Original file line number Diff line number Diff line change 1- package com .baeldung .rest ;
1+ package com .baeldung .ctx2 ;
22
33import org .springframework .boot .autoconfigure .EnableAutoConfiguration ;
44import org .springframework .context .annotation .ComponentScan ;
55import org .springframework .context .annotation .Configuration ;
66import org .springframework .context .annotation .PropertySource ;
77
88@ Configuration
9- @ ComponentScan ("com.baeldung.rest " )
9+ @ ComponentScan ("com.baeldung.ctx2 " )
1010@ EnableAutoConfiguration
11- @ PropertySource ("classpath:rest-app .properties" )
12- public class RestConfig {
11+ @ PropertySource ("classpath:ctx2 .properties" )
12+ public class Ctx2Config {
1313
1414}
Original file line number Diff line number Diff line change 1- package com .baeldung .rest ;
1+ package com .baeldung .ctx2 ;
22
33import org .springframework .beans .factory .annotation .Autowired ;
44import org .springframework .web .bind .annotation .GetMapping ;
55import org .springframework .web .bind .annotation .RestController ;
66
7- import com .baeldung .services .IHomeService ;
7+ import com .baeldung .parent .IHomeService ;
88
99@ RestController
10- public class GreetingController {
10+ public class Ctx2Controller {
1111
1212 @ Autowired
1313 IHomeService homeService ;
Original file line number Diff line number Diff line change 1+ package com .baeldung .parent ;
2+
3+ import org .springframework .boot .WebApplicationType ;
4+ import org .springframework .boot .builder .SpringApplicationBuilder ;
5+
6+ import com .baeldung .ctx1 .Ctx1Config ;
7+ import com .baeldung .ctx2 .Ctx2Config ;
8+
9+ public class App {
10+ public static void main (String [] args ) {
11+ new SpringApplicationBuilder ().parent (ParentConfig .class )
12+ .web (WebApplicationType .NONE )
13+ .child (Ctx1Config .class )
14+ .web (WebApplicationType .SERVLET )
15+ .sibling (Ctx2Config .class )
16+ .web (WebApplicationType .SERVLET )
17+ .run (args );
18+ }
19+ }
Original file line number Diff line number Diff line change 1- package com .baeldung .services ;
1+ package com .baeldung .parent ;
22
33import org .springframework .stereotype .Service ;
44
You can’t perform that action at this time.
0 commit comments