Last active
August 29, 2015 14:18
-
-
Save leon/5913ced04e88fe7ce87f to your computer and use it in GitHub Desktop.
Gradle config for spring data fowler and java 8 dates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spring.jackson: | |
dateFormat: com.fasterxml.jackson.databind.util.ISO8601DateFormat | |
serialization: | |
writeDatesAsTimestamps: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
ext { | |
springBootVersion = '1.2.3.RELEASE' | |
} | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") | |
classpath("io.spring.gradle:dependency-management-plugin:0.4.1.RELEASE") | |
} | |
} | |
apply plugin: 'java' | |
apply plugin: 'idea' | |
apply plugin: 'spring-boot' | |
apply plugin: 'io.spring.dependency-management' | |
jar { | |
baseName = 'test' | |
version = '1.0.0' | |
} | |
sourceCompatibility = 1.8 | |
targetCompatibility = 1.8 | |
dependencyManagement { | |
// applyMavenExclusions will not be needed soon https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/47 | |
applyMavenExclusions false | |
imports { | |
mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}" | |
} | |
} | |
ext['spring-data-releasetrain.version'] = 'Fowler-RELEASE' | |
dependencies { | |
compile('org.springframework.boot:spring-boot-starter-actuator') | |
compile('org.springframework.boot:spring-boot-starter-web') | |
compile('org.springframework.boot:spring-boot-starter-data-jpa') | |
// Included so that jackson serializes dates properly | |
compile('com.fasterxml.jackson.datatype:jackson-datatype-jsr310') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; | |
import org.springframework.boot.orm.jpa.EntityScan; | |
import org.springframework.data.jpa.convert.threeten.Jsr310JpaConverters; | |
@SpringBootApplication | |
// Enable java 8 dates in hibernate | |
@EntityScan(basePackageClasses = { MyApplication.class, Jsr310JpaConverters.class }) | |
public class MyApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(MyApplication.class, args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment