Skip to content

mybatis-spring-2.0.x (Java 8, Spring 5.x and Spring Batch 4.x) #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Apr 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
87dce16
Migrate to Java8
pboonphong Dec 23, 2016
0c10c8b
Upgrade dependencies
pboonphong Dec 23, 2016
95fd630
Upgrade pom version to 2.0.0-SNAPSHOT
pboonphong Dec 23, 2016
60312ff
Support from JDK8 and above as same as Spring 5.x
pboonphong Dec 23, 2016
540395c
Update author name.
pboonphong Dec 23, 2016
ba8601c
Polishing
pboonphong Dec 23, 2016
aaa920c
Upgrade to spring-batch-infrastructure:4.0.0.M1
pboonphong Jan 17, 2017
75d5f5c
Merge branch 'master' into 2.0.x
pboonphong Jan 17, 2017
d3cf731
Update SqlSessionDeoSupport to initialize SqlSessionTemplate as in Hi…
pboonphong Jan 18, 2017
b316dfc
Override animal-sniffer-maven-plugin from java16 to java18
pboonphong Jan 25, 2017
e452050
Upgrade to Spring 5.0.0.M4
pboonphong Jan 25, 2017
2e8e7d4
Use Java Stream to collect basePackages
pboonphong Jan 25, 2017
5bce6f0
Merge branch 'master' into 2.0.x
pboonphong Jan 31, 2017
f329b14
Upgrade to JUnit 5.0.0.M3
pboonphong Mar 19, 2017
bb17bc8
Merge remote-tracking branch 'upstream/master' into 2.0.x
pboonphong Mar 19, 2017
5795b20
Update license headers
pboonphong Mar 19, 2017
fa9c8be
code format
pboonphong Apr 7, 2017
9bf12d4
Wrap Log with Logger to support lambda expressions.
pboonphong Apr 7, 2017
2d129eb
Add mockito 2.7.22 and assertj-core 3.6.2
pboonphong Apr 8, 2017
ed14d39
Migrate to Java8 and add MyBatisBatchItemWriterTest
pboonphong Apr 8, 2017
ce0a6ad
Revert: Migrate to Java8 caused ArrayIndexOutOfBounds
pboonphong Apr 8, 2017
67040b9
Typos
pboonphong Apr 8, 2017
9860a87
Remove unused import
pboonphong Apr 8, 2017
a9bf28c
Move resources from src/main/java to src/main/resources
pboonphong Apr 9, 2017
62e559c
Verify test cases with AssertJ
pboonphong Apr 11, 2017
430bc2b
Revert: Move resources from src/main/java to src/main/resources
pboonphong Apr 11, 2017
530e0bf
Update license headers
pboonphong Apr 11, 2017
db9d2c4
Upgrade to Spring 5.0.0.M5
pboonphong Apr 11, 2017
f8588ce
Upgrade to Junit 5.0.0.M4
pboonphong Apr 11, 2017
fd1a0f3
Update license headers
pboonphong Apr 11, 2017
c94253f
Revert: Update license headers
pboonphong Apr 11, 2017
41347e2
Merge branch 'master' into 2.0.x
Apr 30, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ sudo: false

jdk:
- oraclejdk8
- oraclejdk7
- openjdk7
- openjdk6

after_success:
- chmod -R 777 ./travis/after_success.sh
Expand Down
106 changes: 82 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,23 @@
<groupId>org.mybatis</groupId>
<artifactId>mybatis-parent</artifactId>
<version>28</version>
<relativePath />
<relativePath/>
</parent>

<artifactId>mybatis-spring</artifactId>
<version>1.3.2-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>mybatis-spring</name>
<description>An easy-to-use Spring bridge for MyBatis sql mapping framework.</description>
<url>http://www.mybatis.org/spring/</url>

<contributors>

<contributor>
<name>Alex Rykov</name>
<email>[email protected]</email>
</contributor>

<contributor>
<name>Andrius Juozapaitis</name>
<email>[email protected]</email>
Expand Down Expand Up @@ -103,9 +102,22 @@
<clirr.comparisonVersion>1.2.2</clirr.comparisonVersion>
<findbugs.onlyAnalyze>org.mybatis.spring.*,org.mybatis.spring.mapper.*,org.mybatis.spring.support.*,org.mybatis.spring.transaction.*</findbugs.onlyAnalyze>
<gcu.product>Spring</gcu.product>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.testSource>1.8</maven.compiler.testSource>
<maven.compiler.testTarget>1.8</maven.compiler.testTarget>
<osgi.import>org.springframework.batch.*;resolution:=optional,*</osgi.import>
<osgi.dynamicImport>*</osgi.dynamicImport>
<spring.version>4.3.8.RELEASE</spring.version>

<spring.version>5.0.0.M5</spring.version>
<spring-batch.version>4.0.0.M1</spring-batch.version>
<junit-platform.version>1.0.0-M4</junit-platform.version>
<junit.version>5.0.0-M4</junit.version>

<!-- Override: Animal Sniffer Signature -->
<signature.group>org.codehaus.mojo.signature</signature.group>
<signature.artifact>java18</signature.artifact>
<signature.version>1.0</signature.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -133,7 +145,7 @@
<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-infrastructure</artifactId>
<version>3.0.7.RELEASE</version>
<version>4.0.0.M1</version>
<scope>provided</scope>
</dependency>

Expand All @@ -143,24 +155,37 @@
<dependency>
<groupId>com.atomikos</groupId>
<artifactId>transactions-jdbc</artifactId>
<version>4.0.3</version>
<version>4.0.4</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.12.1.1</version>
<version>10.13.1.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.0.0-M4</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-platform.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.byteman</groupId>
<artifactId>byteman-bmunit</artifactId>
Expand Down Expand Up @@ -196,20 +221,32 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.7.22</version>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.6.2</version>
</dependency>

<!-- Using version 1.0.1, versions higher require only jdk7 -->
<dependency>
<groupId>com.mockrunner</groupId>
<artifactId>mockrunner-core</artifactId>
<version>1.0.1</version>
<version>1.1.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>com.kirkk</groupId>
<artifactId>jaranalyzer</artifactId>
<groupId>com.kirkk</groupId>
<artifactId>jaranalyzer</artifactId>
</exclusion>
<exclusion>
<groupId>jdom</groupId>
Expand All @@ -224,7 +261,7 @@
<dependency>
<groupId>com.mockrunner</groupId>
<artifactId>mockrunner-ejb</artifactId>
<version>1.0.1</version>
<version>1.1.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
Expand All @@ -240,28 +277,38 @@
<dependency>
<groupId>com.mockrunner</groupId>
<artifactId>mockrunner-jdbc</artifactId>
<version>1.0.1</version>
<version>1.1.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.transaction</groupId>
<artifactId>transaction-api</artifactId>
<version>1.1</version>
<artifactId>javax.transaction-api</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<version>3.1.0</version>
<scope>test</scope>
</dependency>

</dependencies>

<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -275,10 +322,21 @@
<name>com.atomikos.icatch.log_base_dir</name>
<value>${project.build.directory}</value>
</property>
</systemProperties>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit-platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
Expand Down
59 changes: 59 additions & 0 deletions src/main/java/org/mybatis/logging/Logger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* Copyright 2010-2017 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mybatis.logging;

import org.apache.ibatis.logging.Log;

import java.util.function.Supplier;

/**
* Wrapper of {@link Log}, allow log with lambda expressions.
*
* @author Putthiphong Boonphong
*/
public class Logger {

private Log log;

Logger(Log log) {
this.log = log;
}

public void error(Supplier<String> s, Throwable e) {
log.error(s.get(), e);
}

public void error(Supplier<String> s) {
log.error(s.get());
}

public void warn(Supplier<String> s) {
log.warn(s.get());
}

public void debug(Supplier<String> s) {
if (log.isDebugEnabled()) {
log.debug(s.get());
}
}

public void trace(Supplier<String> s) {
if (log.isTraceEnabled()) {
log.trace(s.get());
}
}

}
35 changes: 35 additions & 0 deletions src/main/java/org/mybatis/logging/LoggerFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright 2010-2017 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mybatis.logging;

import org.apache.ibatis.logging.LogFactory;

/**
* LoggerFactory is a wrapper around {@link LogFactory} to support {@link Logger}.
*
* @author Putthiphong Boonphong
*/
public class LoggerFactory {

public static Logger getLogger(Class<?> aClass) {
return new Logger(LogFactory.getLog(aClass));
}

public static Logger getLogger(String logger) {
return new Logger(LogFactory.getLog(logger));
}

}
Loading