spac mi sie chce

This commit is contained in:
lukasgol committed 2015-01-25 00:55:41 +01:00
1 parent 2dc62ad286
commit 6737cd101e
11 files changed
+472 -134

No files matched your search

+20 -35
View File
@@ -1,24 +1,23 @@
package hello;
import org.springframework.beans.factory.annotation.Autowired;
import hello.agh.edu.bazy.postgresql.gis.GisDataSource;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.util.List;
@ComponentScan
@EnableAutoConfiguration
@EnableWebMvc
@Configuration
/*
@ImportResource("classpath:/database-blueprint1.xml")
*/
public class Application extends WebMvcConfigurerAdapter implements CommandLineRunner{
@Autowired
CustomerRepository repository;
public static void main(String[] args) {
@@ -27,36 +26,7 @@ public class Application extends WebMvcConfigurerAdapter implements CommandLineR
@Override
public void run(String... args) throws Exception {
// save a couple of customers
repository.save(new Customer("aJack", "Bauer"));
repository.save(new Customer("aChloe", "O'Brian"));
repository.save(new Customer("aKim", "Bauer"));
repository.save(new Customer("aDavid", "Palmer"));
repository.save(new Customer("aMichelle", "Dessler"));
// fetch all customers
Iterable<Customer> customers = repository.findAll();
System.out.println("Customers found with findAll():");
System.out.println("-------------------------------");
for (Customer customer : customers) {
System.out.println(customer);
}
System.out.println();
// fetch an individual customer by ID
Customer customer = repository.findOne(1L);
System.out.println("Customer found with findOne(1L):");
System.out.println("--------------------------------");
System.out.println(customer);
System.out.println();
// fetch customers by last name
List<Customer> bauers = repository.findByLastName("Bauer");
System.out.println("Customer found with findByLastName('Bauer'):");
System.out.println("--------------------------------------------");
for (Customer bauer : bauers) {
System.out.println(bauer);
}
// context.close();
}
@@ -65,4 +35,19 @@ public class Application extends WebMvcConfigurerAdapter implements CommandLineR
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new SampleInterceptor()).addPathPatterns("/**");
}
/*
@Bean(name = "gisosmDataSource")
public GisDataSource dataSource() {
GisDataSource dataSource = new GisDataSource();
dataSource.setDriverClassName("org.postgis.DriverWrapper");
dataSource.setUrl("jdbc:postgresql_postGIS://10.156.207.136:5432/osm");
dataSource.setPassword("ztb2015");
dataSource.setUsername("postgres");
return dataSource; }
*/
}