Skip to content

Commit 682c251

Browse files
committed
Final removal of Hibernate/Spring-Data-JPA.
This change removes 16 JARs from dependencies and also makes WAR lighter on 8Mb. Also it reduces startup time on about 2-3 seconds on my MacBook. Addressed to #120 No functional changes.
1 parent e3038c3 commit 682c251

File tree

9 files changed

+2
-118
lines changed

9 files changed

+2
-118
lines changed

NEWS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- (functionality) add possibility for search series by catalog number (contributed by Sergey Chechenev)
88
- (functionality) add interface for viewing suspicious activity (contributed by Sergey Chechenev)
99
- (functionality) allow to users to add categories and countries
10+
- (infrastructure) ported to Spring's JdbcTemplate (get rid of Spring-Data-JPA and Hibernate)
1011

1112
0.3
1213
- (functionality) implemented possibility to user to add series to his collection

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ If you are programmer/sysadmin or you just feeling that you are able to run loca
4141
* *UI*: HTML, Bootstrap and a bit of JavaScript with JQuery
4242
* *Security*: Spring Security
4343
* *Databases*: H2 or MySQL
44-
* *Database access*: Spring Data JPA (and Hibernate as JPA provider) or Spring's `JdbcTemplate`
44+
* *Database access*: Spring's `JdbcTemplate`
4545
* *Database migrations*: Liquibase
4646
* *Validation*: JSR-303 (Hibernate Validator)
4747
* *Logging*: Slf4j (log4j)

pom.xml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<subethasmtp.version>3.1.7</subethasmtp.version>
2424
<aspectj.version>1.8.5</aspectj.version>
2525
<javax.validation.version>1.1.0.Final</javax.validation.version>
26-
<javax.persistence.version>1.0.0.Final</javax.persistence.version>
2726
<servlet.api.version>3.0.20100224</servlet.api.version>
2827
<commons.lang.version>3.4</commons.lang.version>
2928
<commons.io.version>2.4</commons.io.version>
@@ -70,7 +69,6 @@
7069
<commons-dbcp.version>1.4</commons-dbcp.version>
7170
<commons-pool.version>1.5.4</commons-pool.version>
7271
<groovy.version>2.0.8</groovy.version>
73-
<hibernate.version>4.3.6.Final</hibernate.version>
7472
<hibernate-validator.version>5.2.4.Final</hibernate-validator.version>
7573
<javax-mail.version>1.5.4</javax-mail.version>
7674
<jetty.version>9.2.11.v20150529</jetty.version>
@@ -185,12 +183,6 @@
185183
</exclusions>
186184
</dependency>
187185

188-
<!-- https://github.com/spring-projects/spring-boot/blob/v1.3.0.RELEASE/spring-boot-starters/spring-boot-starter-data-jpa/pom.xml -->
189-
<dependency>
190-
<groupId>org.springframework.boot</groupId>
191-
<artifactId>spring-boot-starter-data-jpa</artifactId>
192-
</dependency>
193-
194186
<dependency>
195187
<groupId>org.mortbay.jetty</groupId>
196188
<artifactId>servlet-api</artifactId>
@@ -204,25 +196,13 @@
204196
<version>${javax.validation.version}</version>
205197
</dependency>
206198

207-
<dependency>
208-
<groupId>org.hibernate.javax.persistence</groupId>
209-
<artifactId>hibernate-jpa-2.1-api</artifactId>
210-
<version>${javax.persistence.version}</version>
211-
</dependency>
212-
213199
<dependency>
214200
<groupId>org.aspectj</groupId>
215201
<artifactId>aspectjweaver</artifactId>
216202
<version>${aspectj.version}</version>
217203
<scope>runtime</scope>
218204
</dependency>
219205

220-
<dependency>
221-
<groupId>org.hibernate</groupId>
222-
<artifactId>hibernate-core</artifactId>
223-
<!-- Required in compiled scope for customized version of MySQL5InnoDBDialect -->
224-
</dependency>
225-
226206
<dependency>
227207
<groupId>org.apache.commons</groupId>
228208
<artifactId>commons-lang3</artifactId>
@@ -402,17 +382,6 @@
402382
</exclusions>
403383
</dependency>
404384

405-
<!--
406-
Hibernate 4.3.x has dependency on 1.0.b2 version but htmlunit
407-
doesn't work with this version, so we need specify it manually.
408-
-->
409-
<dependency>
410-
<groupId>xml-apis</groupId>
411-
<artifactId>xml-apis</artifactId>
412-
<version>1.4.01</version>
413-
<scope>test</scope>
414-
</dependency>
415-
416385
<dependency>
417386
<groupId>org.hibernate</groupId>
418387
<artifactId>hibernate-validator</artifactId>

src/main/java/ru/mystamps/web/config/MvcConfig.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
import org.springframework.context.annotation.Configuration;
2626
import org.springframework.context.annotation.Import;
2727
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
28-
import org.springframework.data.repository.support.DomainClassConverter;
2928
import org.springframework.format.FormatterRegistry;
30-
import org.springframework.format.support.FormattingConversionService;
3129
import org.springframework.scheduling.annotation.EnableScheduling;
3230
import org.springframework.validation.Validator;
3331
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
@@ -124,10 +122,4 @@ public LocaleResolver getLocaleResolver() {
124122
return resolver;
125123
}
126124

127-
@Bean
128-
@Autowired
129-
public DomainClassConverter<?> getDomainClassConverter(FormattingConversionService service) {
130-
return new DomainClassConverter<FormattingConversionService>(service);
131-
}
132-
133125
}

src/main/java/ru/mystamps/web/support/hibernate/MySql5InnoDbDialect.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/main/resources/META-INF/persistence.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/main/resources/application-prod.properties

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ spring.datasource.initialize: false
88
spring.datasource.validation-query: SELECT 1
99
spring.datasource.test-on-borrow: true
1010

11-
spring.jpa.database-platform: ru.mystamps.web.support.hibernate.MySql5InnoDbDialect
12-
spring.jpa.show-sql: false
13-
spring.jpa.properties.hibernate.format_sql: true
14-
spring.jpa.properties.hibernate.connection.charset: UTF-8
15-
spring.jpa.properties.hibernate.hbm2ddl.auto: validate
16-
# our mapping doesn't conform to org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy that is used by default
17-
spring.jpa.hibernate.naming_strategy: org.hibernate.cfg.EJB3NamingStrategy
18-
spring.jpa.open-in-view: false
19-
2011
spring.mail.host: 127.0.0.1
2112
spring.mail.port: 25
2213
spring.mail.username: test

src/main/resources/application-test.properties

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@ spring.h2.console.enabled: true
1010
spring.h2.console.path: /console
1111
security.basic.enabled: false
1212

13-
spring.jpa.database-platform: org.hibernate.dialect.H2Dialect
14-
spring.jpa.show-sql: false
15-
spring.jpa.properties.hibernate.format_sql: true
16-
spring.jpa.properties.hibernate.connection.charset: UTF-8
17-
spring.jpa.properties.hibernate.hbm2ddl.auto: validate
18-
# our mapping doesn't conform to org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy that is used by default
19-
spring.jpa.hibernate.naming_strategy: org.hibernate.cfg.EJB3NamingStrategy
20-
spring.jpa.open-in-view: false
21-
2213
spring.mail.host: 127.0.0.1
2314
spring.mail.port: 1025
2415
spring.mail.username: unused
@@ -44,7 +35,6 @@ logging.level.ru.mystamps: DEBUG
4435
logging.level.liquibase: WARN
4536
logging.level.org.springframework.web.servlet.handler.SimpleUrlHandlerMapping: WARN
4637
logging.level.org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping: WARN
47-
logging.level.org.hibernate.tool.hbm2ddl.TableMetadata: WARN
4838

4939
spring.autoconfigure.exclude: \
5040
org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration \

src/main/resources/application-travis.properties

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ spring.datasource.initialize: false
88
spring.datasource.validation-query: SELECT 1
99
spring.datasource.test-on-borrow: true
1010

11-
spring.jpa.database-platform: ru.mystamps.web.support.hibernate.MySql5InnoDbDialect
12-
spring.jpa.show-sql: false
13-
spring.jpa.properties.hibernate.format_sql: true
14-
spring.jpa.properties.hibernate.connection.charset: UTF-8
15-
spring.jpa.properties.hibernate.hbm2ddl.auto: validate
16-
# our mapping doesn't conform to org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy that is used by default
17-
spring.jpa.hibernate.naming_strategy: org.hibernate.cfg.EJB3NamingStrategy
18-
spring.jpa.open-in-view: false
19-
2011
spring.mail.host: 127.0.0.1
2112
spring.mail.port: 1025
2213
spring.mail.username: unused
@@ -41,7 +32,6 @@ logging.level.: INFO
4132
logging.level.ru.mystamps: DEBUG
4233
logging.level.org.springframework.web.servlet.handler.SimpleUrlHandlerMapping: WARN
4334
logging.level.org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping: WARN
44-
logging.level.org.hibernate.tool.hbm2ddl.TableMetadata: WARN
4535

4636
app.upload.dir: /tmp
4737

0 commit comments

Comments
 (0)