├── .gitignore ├── README.md ├── pom.xml └── src └── main ├── java └── com │ └── slyak │ └── spring │ ├── JpaExtraAutoConfiguration.java │ └── SpringJpaExtraProperties.java └── resources └── META-INF └── spring.factories /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | *.mvn 23 | 24 | # Logs and databases # 25 | ###################### 26 | *.log 27 | 28 | # OS generated files # 29 | ###################### 30 | .DS_Store* 31 | ehthumbs.db 32 | Icon? 33 | Thumbs.db 34 | 35 | # Editor Files # 36 | ################ 37 | *~ 38 | *.swp 39 | 40 | # Gradle Files # 41 | ################ 42 | .gradle 43 | 44 | # Build output directies 45 | /target 46 | *.lst 47 | */target 48 | /build 49 | */build 50 | 51 | # IntelliJ specific files/directories 52 | out 53 | .idea 54 | *.ipr 55 | *.iws 56 | *.iml 57 | atlassian-ide-plugin.xml 58 | 59 | # Eclipse specific files/directories 60 | .classpath 61 | .project 62 | .settings 63 | .metadata 64 | */bin 65 | 66 | # NetBeans specific files/directories 67 | .nbattrs 68 | 69 | # DOMJS 注释掉 70 | js/DOMJS 71 | bower_components/* 72 | .idea/ 73 | dist/* 74 | *.class 75 | 76 | # Package Files # 77 | *.jar 78 | *.war 79 | *.ear 80 | node_modules 81 | # test# 82 | test -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | spring boot starter for spring-data-jpa-extra 2 | TODO: 3 | add EnableJpaRepositories config 4 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | spring-boot-starter-jpa-extra 7 | 2.1.0.RELEASE 8 | jar 9 | ${project.groupId}:${project.artifactId} 10 | Spring boot starter for spring-boot-starter-jpa-extra 11 | https://github.com/slyak/spring-boot-starter-jpa-extra 12 | 13 | 14 | com.slyak 15 | slyak-parent 16 | 1.3.0.RELEASE 17 | 18 | 19 | 20 | 21 | slyak 22 | https://github.com/slyak 23 | 24 | 25 | 26 | 27 | Github Issue 28 | https://github.com/slyak/spring-boot-starter-jpa-extra/issues 29 | 30 | 31 | 32 | 33 | 34 | The Apache Software License, Version 2.0 35 | http://www.apache.org/licenses/LICENSE-2.0.txt 36 | 37 | 38 | 39 | 40 | 41 | 42 | stormning 43 | 周宁 44 | stormning@163.com 45 | 46 | creator 47 | manager 48 | developer 49 | committer 50 | 51 | 52 | 53 | 54 | 55 | 56 | scm:git:git@github.com:slyak/spring-boot-starter-jpa-extra.git 57 | scm:git:git@github.com:slyak/spring-boot-starter-jpa-extra.git 58 | git@github.com:slyak/spring-boot-starter-jpa-extra.git 59 | 60 | 61 | 62 | ${project.version} 63 | 64 | 65 | 66 | 67 | org.springframework.boot 68 | spring-boot 69 | 70 | 71 | 72 | org.springframework.boot 73 | spring-boot-autoconfigure 74 | 75 | 76 | 77 | org.springframework.boot 78 | spring-boot-configuration-processor 79 | true 80 | 81 | 82 | 83 | org.springframework.boot 84 | spring-boot-starter-data-jpa 85 | 86 | 87 | 88 | com.slyak 89 | spring-data-jpa-extra 90 | ${spring-data-jpa-extra-version} 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | org.apache.maven.plugins 99 | maven-compiler-plugin 100 | 3.1 101 | 102 | lines,vars,source 103 | 104 | 105 | ${java.home}/lib/rt.jar 106 | 107 | 1.6 108 | 1.6 109 | 110 | 111 | 112 | 113 | org.apache.maven.plugins 114 | maven-source-plugin 115 | 116 | 117 | attach-sources 118 | package 119 | 120 | jar 121 | 122 | 123 | 124 | 125 | 126 | 127 | org.apache.maven.plugins 128 | maven-javadoc-plugin 129 | 130 | 131 | attach-javadoc 132 | package 133 | 134 | jar 135 | 136 | 137 | 138 | 139 | public 140 | ${project.build.sourceEncoding} 141 | ${project.build.sourceEncoding} 142 | ${project.build.sourceEncoding} 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | oss-snapshots 151 | oss-snapshots 152 | https://oss.sonatype.org/content/repositories/snapshots/ 153 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /src/main/java/com/slyak/spring/JpaExtraAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.slyak.spring; 2 | 3 | import com.slyak.spring.jpa.FreemarkerSqlTemplates; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.boot.autoconfigure.AutoConfigureAfter; 6 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; 7 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | * . 13 | * 14 | * @author stormning on 16/6/10. 15 | */ 16 | @Configuration 17 | @EnableConfigurationProperties(SpringJpaExtraProperties.class) 18 | @AutoConfigureAfter({ DataSourceAutoConfiguration.class }) 19 | public class JpaExtraAutoConfiguration { 20 | 21 | @Autowired 22 | private SpringJpaExtraProperties springJpaProperties; 23 | 24 | @Bean 25 | protected FreemarkerSqlTemplates freemarkerSqlTemplates() { 26 | FreemarkerSqlTemplates sqlTemplates = new FreemarkerSqlTemplates(); 27 | String templateBasePackage = springJpaProperties.getTemplateBasePackage(); 28 | if (templateBasePackage != null) { 29 | sqlTemplates.setTemplateBasePackage(templateBasePackage); 30 | } 31 | String templateLocation = springJpaProperties.getTemplateLocation(); 32 | if (templateLocation != null) { 33 | sqlTemplates.setTemplateLocation(templateLocation); 34 | } 35 | sqlTemplates.setSuffix(".sftl"); 36 | return sqlTemplates; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/slyak/spring/SpringJpaExtraProperties.java: -------------------------------------------------------------------------------- 1 | package com.slyak.spring; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | /** 6 | * . 7 | * 8 | * @author stormning on 16/6/10. 9 | */ 10 | @ConfigurationProperties(prefix = "spring.jpa.extra") 11 | public class SpringJpaExtraProperties { 12 | 13 | private String templateLocation; 14 | 15 | private String templateBasePackage; 16 | 17 | 18 | public String getTemplateLocation() { 19 | return templateLocation; 20 | } 21 | 22 | public void setTemplateLocation(String templateLocation) { 23 | this.templateLocation = templateLocation; 24 | } 25 | 26 | public String getTemplateBasePackage() { 27 | return templateBasePackage; 28 | } 29 | 30 | public void setTemplateBasePackage(String templateBasePackage) { 31 | this.templateBasePackage = templateBasePackage; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.slyak.spring.JpaExtraAutoConfiguration --------------------------------------------------------------------------------