Skip to content

Commit

Permalink
Upgraded to Spring Boot 1.0.RC1.
Browse files Browse the repository at this point in the history
Removed more obsolete configuration code \o/. Raised interceptor log level in interceptor sample project. Changed SQL to accomodate new default naming strategy for Hibernate.
  • Loading branch information
odrotbohm committed Jan 22, 2014
1 parent b01ffd8 commit 955d5d9
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 106 deletions.
2 changes: 0 additions & 2 deletions java8-auditing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@

<dependencies>

<!-- TODO: Remove, once https://github.com/spring-projects/spring-boot/pull/184 gets accepted -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013 the original author or authors.
* Copyright 2013-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,28 +18,18 @@
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import javax.sql.DataSource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
* Integration test to show the usage of Java 8 date time APIs with Spring Data JPA auditing.
* <p>
* TODO: Move to @EnableAutoConfiguration when Boot 0.5 M8 is released
*
* @author Oliver Gierke
*/
Expand All @@ -48,35 +38,11 @@
public class Java8AuditingIntegrationTests {

@Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableJpaRepositories
@EnableJpaAuditing
static class Config {

@Bean
LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {

HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(true);

LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan(getClass().getPackage().getName());
factory.setMappingResources("META-INF/orm.xml");
factory.setDataSource(dataSource);

return factory;
}

@Bean
DataSource dataSource() {
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL).build();
}

@Bean
JpaTransactionManager transactionManager() {
return new JpaTransactionManager();
}
}

@Autowired CustomerRepository repository;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>0.5.0.M7</version>
<version>1.0.0.RC1</version>
</parent>

<name>Spring Data JPA sample projects</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012 the original author or authors.
* Copyright 2012-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,14 +19,14 @@
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.aop.interceptor.CustomizableTraceInterceptor;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Import;

@Configuration
@Import(InfrastructureConfiguration.class)
@EnableAspectJAutoProxy
@EnableAutoConfiguration
public class ApplicationConfiguration {

@Bean
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</appender>

<logger name="org.springframework" level="error" />
<logger name="org.springframework.aop.interceptor" level="trace" />

<root level="error">
<appender-ref ref="console" />
Expand Down
4 changes: 2 additions & 2 deletions spring-data-jpa-showcase/src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ INSERT INTO Customer (id, firstname, lastname) VALUES (1, 'Dave', 'Matthews');
INSERT INTO Customer (id, firstname, lastname) VALUES (2, 'Carter', 'Beauford');
INSERT INTO Customer (id, firstname, lastname) VALUES (3, 'Stephan', 'Lassard');

INSERT INTO Account (id, customer, expiry_date) VALUES (1, 1, '2010-12-31');
INSERT INTO Account (id, customer, expiry_date) VALUES (2, 1, '2011-03-31');
INSERT INTO Account (id, customer_id, expiry_date) VALUES (1, 1, '2010-12-31');
INSERT INTO Account (id, customer_id, expiry_date) VALUES (2, 1, '2011-03-31');

INSERT INTO Customer (id, firstname, lastname) VALUES (4, 'Charly', 'Matthews');
INSERT INTO Customer (id, firstname, lastname) VALUES (5, 'Chris', 'Matthews');
Expand Down

0 comments on commit 955d5d9

Please sign in to comment.