package com.github.dddpaul;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplicationBuilder parentBuilder = new SpringApplicationBuilder(Application.class);
        parentBuilder.child(ServiceOneConfiguration.class).properties("server.port:8081").run(args);
        parentBuilder.child(ServiceTwoConfiguration.class).properties("server.port:8082").run(args);
    }

    @Service
    static class SharedService {
        public String getMessage() {
            return "I'm shared service";
        }
    }

    @Configuration
    @EnableAutoConfiguration
    static class ServiceOneConfiguration {
        @Controller
        @RequestMapping("/one")
        static class ControllerOne {
            @Autowired
            private SharedService service;

            @RequestMapping
            @ResponseBody
            public String getMessage() {
                return "ControllerOne says \"" + service.getMessage() + "\"";
            }
        }
    }

    @Configuration
    @EnableAutoConfiguration
    static class ServiceTwoConfiguration {
        @Controller
        @RequestMapping("/two")
        static class ControllerOne {
            @Autowired
            private SharedService service;

            @RequestMapping
            @ResponseBody
            public String getMessage() {
                return "ControllerTwo says \"" + service.getMessage() + "\"";
            }
        }
    }
}

@@ -287,24 +287,201 @@
 ionBuilder;%0A
+import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;%0Aimport org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;%0A
 import org.s
@@ -1277,32 +1277,43 @@
 ring getMessage(
+String name
 ) %7B%0A            
@@ -1323,10 +1323,35 @@
 urn 
-%22I
+String.format(%22Hello, %25s, i
 'm s
@@ -1364,16 +1364,23 @@
 service%22
+, name)
 ;%0A      
@@ -1720,32 +1720,43 @@
 ring getMessage(
+String name
 ) %7B%0A            
@@ -1803,32 +1803,36 @@
 vice.getMessage(
+name
 ) + %22%5C%22%22;%0A      
@@ -1939,32 +1939,294 @@
 Configuration %7B%0A
+        @Bean%0A        EmbeddedServletContainerFactory servletContainer() %7B%0A            TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();%0A            tomcat.setUriEncoding(%22cp1251%22);%0A            return tomcat;%0A        %7D%0A%0A
         @Control
@@ -2456,16 +2456,27 @@
 Message(
+String name
 ) %7B%0A    
@@ -2539,16 +2539,20 @@
 Message(
+name
 ) + %22%5C%22%22

Set URI encoding to cp1251 for ControllerTwo