REST-Dienste mit Spring und Java -- ganz schnell
Schönes kleines Tutorial wie man REST-Services mit Spring und JDK8 aufsetzt (und sichert).
Insbesondere finde ich dies hier bemerkenswert:
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application implements CommandLineRunner {
private Logger logger = LoggerFactory.getLogger(Application.class);
@Autowired
private SomeService someService;
@Override
public void run(String... args) throws Exception {
String foo = someService.foo();
logger.info("SomeService returned {}", foo);
}
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}Ein CommandLineRunner ist schon eine Wucht… :)