injection point example (#1850)

This commit is contained in:
lor6
2017-05-15 14:46:35 +03:00
committed by Grzegorz Piwowarek
parent ce2f24d048
commit 0c973f492e
4 changed files with 41 additions and 1 deletions
@@ -6,12 +6,16 @@ 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.RequestMapping;
import org.apache.logging.log4j.Logger;
@Controller
@RequestMapping("/appointments")
public class AppointmentsController {
private final AppointmentService appointmentService;
private AppointmentService appointmentService;
@Autowired
private Logger logger;
@Autowired
public AppointmentsController(AppointmentService appointmentService) {
@@ -20,6 +24,7 @@ public class AppointmentsController {
@GetMapping
public Map<String, Appointment> get() {
logger.info("Getting appointments...");
return appointmentService.getAppointmentsForToday();
}
@@ -0,0 +1,11 @@
rootLogger.level=info
rootLogger.appenderRefs = stdout
rootLogger.appenderRef.stdout.ref = STDOUT
appenders=console
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %p %d{yyyy-MM-dd} [%t] %c{1} - %msg%n