JAVA-8664: Change ports numbers and cleanup the code
This commit is contained in:
parent
74797c43dd
commit
2f9ce6cf36
|
@ -1,22 +1,18 @@
|
||||||
package com.baeldung.ctx1;
|
package com.baeldung.ctx1;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
|
|
||||||
import com.baeldung.parent.IHomeService;
|
import com.baeldung.parent.IHomeService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@Controller
|
@RestController
|
||||||
public class Ctx1Controller {
|
public class Ctx1Controller {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IHomeService homeService;
|
private IHomeService homeService;
|
||||||
|
|
||||||
@GetMapping("/home")
|
@GetMapping("/home")
|
||||||
@ResponseBody
|
|
||||||
public String greeting() {
|
public String greeting() {
|
||||||
|
|
||||||
return homeService.getGreeting();
|
return homeService.getGreeting();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
package com.baeldung.ctx2;
|
package com.baeldung.ctx2;
|
||||||
|
|
||||||
|
import com.baeldung.parent.IHomeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.baeldung.parent.IHomeService;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class Ctx2Controller {
|
public class Ctx2Controller {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IHomeService homeService;
|
private IHomeService homeService;
|
||||||
|
|
||||||
@GetMapping(value = "/greeting", produces = "application/json")
|
@GetMapping(value = "/greeting")
|
||||||
public String getGreeting() {
|
public String getGreeting() {
|
||||||
return homeService.getGreeting();
|
return homeService.getGreeting();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
server.port=8081
|
server.port=8074
|
||||||
server.servlet.context-path=/ctx1
|
server.servlet.context-path=/ctx1
|
||||||
#logging.level=debug
|
#logging.level=debug
|
||||||
spring.application.admin.enabled=false
|
spring.application.admin.enabled=false
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
server.port=8082
|
server.port=8075
|
||||||
server.servlet.context-path=/ctx2
|
server.servlet.context-path=/ctx2
|
||||||
|
|
||||||
spring.application.admin.enabled=false
|
spring.application.admin.enabled=false
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.baeldung.parent.App;
|
||||||
public class SpringContextTest {
|
public class SpringContextTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void testMain() throws Exception {
|
public final void testMain() {
|
||||||
App.main(new String[] {});
|
App.main(new String[] {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue