initial commit

This commit is contained in:
Zellweger Christof Ralf
2015-05-27 16:59:20 +02:00
parent d4e8617ae2
commit 0fe81045d5
21 changed files with 138 additions and 18 deletions

View File

@ -0,0 +1,13 @@
package ch.psi.daq.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import ch.psi.daq.cassandra.writer.CassandraWriter;
@RestController
public class DaqController {
@Autowired
private CassandraWriter writer;
}

View File

@ -0,0 +1,45 @@
package ch.psi.daq.rest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
/**
* Entry point to our rest-frontend of the Swissfel application which most importantly wires all the @RestController annotated classes.
* <p>
*
* This acts as a @Configuration class for Spring. As such it has @ComponentScan
* annotation that enables scanning for another Spring components in current
* package and its subpackages.
* <p>
* Another annotation is @EnableAutoConfiguration which tells Spring Boot to run
* autoconfiguration.
* <p>
* It also extends SpringBootServletInitializer which will configure Spring
* servlet for us, and overrides the configure() method to point to itself, so
* Spring can find the main configuration.
* <p>
* Finally, the main() method consists of single static call to
* SpringApplication.run().
* <p>
* Methods annotated with {@link @Bean} are Java beans that are
* container-managed, i.e. managed by Spring. Whenever there are @Autowire, @Inject
* or similar annotations found in the code (which is being scanned through the @ComponentScan
* annotation), the container then knows how to create those beans and inject
* them accordingly.
*/
@SpringBootApplication
@ComponentScan(basePackages = { "ch.psi.daq" })
public class DaqRestApplication extends SpringBootServletInitializer {
public static void main(final String[] args) {
SpringApplication.run(DaqRestApplication.class, args);
}
@Override
protected final SpringApplicationBuilder configure(final SpringApplicationBuilder application) {
return application.sources(DaqRestApplication.class);
}
}