JAVA-8664: Change ports numbers and cleanup the code

This commit is contained in:
Krzysiek 2021-11-24 09:47:43 +01:00
parent 74797c43dd
commit 2f9ce6cf36
5 changed files with 11 additions and 16 deletions

View File

@ -1,22 +1,18 @@
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 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 {
@Autowired
IHomeService homeService;
private IHomeService homeService;
@GetMapping("/home")
@ResponseBody
public String greeting() {
return homeService.getGreeting();
}
}

View File

@ -1,18 +1,17 @@
package com.baeldung.ctx2;
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;
import com.baeldung.parent.IHomeService;
@RestController
public class Ctx2Controller {
@Autowired
IHomeService homeService;
private IHomeService homeService;
@GetMapping(value = "/greeting", produces = "application/json")
@GetMapping(value = "/greeting")
public String getGreeting() {
return homeService.getGreeting();
}

View File

@ -1,4 +1,4 @@
server.port=8081
server.port=8074
server.servlet.context-path=/ctx1
#logging.level=debug
spring.application.admin.enabled=false

View File

@ -1,4 +1,4 @@
server.port=8082
server.port=8075
server.servlet.context-path=/ctx2
spring.application.admin.enabled=false

View File

@ -7,7 +7,7 @@ import com.baeldung.parent.App;
public class SpringContextTest {
@Test
public final void testMain() throws Exception {
public final void testMain() {
App.main(new String[] {});
}
}