Skip to content

Commit

Permalink
Fix ClassNotFoundException when no JPA on classpath
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienlauer committed Jan 13, 2017
1 parent a466072 commit 2011169
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 3.0.1 (2017-01-13)

* [fix] Fix ClassNotFoundException on EntityManager when JPA is not in the classpath.

# Version 3.0.0 (2016-12-15)

* [brk] Update to SeedStack 16.11 new configuration system.
Expand Down
2 changes: 1 addition & 1 deletion batch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.seedstack.addons.spring</groupId>
<artifactId>spring-bridge</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.0.1-SNAPSHOT</version>
</parent>

<artifactId>spring-bridge-batch</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>org.seedstack.addons.spring</groupId>
<artifactId>spring-bridge</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.0.1-SNAPSHOT</version>
</parent>

<artifactId>spring-bridge-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import io.nuun.kernel.api.plugin.request.ClasspathScanRequest;
import io.nuun.kernel.spi.DependencyInjectionProvider;
import org.seedstack.seed.core.internal.AbstractSeedPlugin;
import org.seedstack.shed.reflect.Classes;
import org.seedstack.spring.SpringConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -31,6 +32,7 @@ public class SpringPlugin extends AbstractSeedPlugin {
private static final Logger LOGGER = LoggerFactory.getLogger(SpringPlugin.class);
private static final String APPLICATION_CONTEXT_REGEX = ".*-context.xml$";
private final Set<String> applicationContextsPaths = new HashSet<>();
private final boolean jpaPresent = Classes.optional("javax.persistence.EntityManager").isPresent();
private ClassPathXmlApplicationContext globalApplicationContext;
private SpringConfig springConfig;

Expand Down Expand Up @@ -82,7 +84,7 @@ public Object nativeUnitModule() {

@Override
public Object nativeOverridingUnitModule() {
if (springConfig.isManageJpa()) {
if (jpaPresent && springConfig.isManageJpa()) {
return new SpringJpaModule(getApplication());
} else {
return null;
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

<groupId>org.seedstack.addons.spring</groupId>
<artifactId>spring-bridge</artifactId>
<version>3.0.0-SNAPSHOT</version>
<version>3.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<seed.version>3.0.0</seed.version>
<business.version>3.0.0</business.version>
<seed.version>3.0.1</seed.version>
<business.version>3.0.1</business.version>
<jpa-addon.version>3.0.0</jpa-addon.version>
<spring.version>4.0.5.RELEASE</spring.version>
<spring-batch.version>3.0.6.RELEASE</spring-batch.version>
Expand Down

0 comments on commit 2011169

Please sign in to comment.