-
Notifications
You must be signed in to change notification settings - Fork 0
Migration Guide from OASP4j 1.5.0 to OASP4j 2.0.0
Following are two approaches to migrate oasp4j 1.5.0 to oasp4j 2.0.0:
-
Approach 1 lists all modified, added and deleted files. You need to do corresponding changes in your existing project.
-
Approach 2 is creating new project with oasp4j template 2.0.0. Then copy all your business logic in newly created project.
Approach 1:
List of files modified added and deleted for oasp4j 2.0.0 version: Files modified:
-
Oasp4j-sample-core\pom.xml
-
Oasp4j-sample-server\pom.xml
-
Oasp4j-sample-server\ src\main\webapp\WEB-INF\web.xml
Files added:
-
core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\BeansBatchConfig.java
-
core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\BeansDozerConfiguration.java
-
core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\DefaultRolesPrefixPostProcessor.java
-
core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\ServiceConfiguration.java
-
core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\WebConfig.java
-
core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\WebSecurityConfig.java
-
core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\security\CsrfRequestMatcher.java
-
core\src\main\java\io\oasp\gastronomy\restaurant\SpringBootApp.java
Files Deleted:
-
core\src\main\resources\config\app\beans-application.xml
-
core\src\main\resources\config\app\common\beans-common.xml
-
core\src\main\resources\config\app\common\beans-dozer.xml
-
core\src\main\resources\config\app\dataaccess\beans-dataaccess.xml
-
core\src\main\resources\config\app\dataaccess\beans-db-plain.xml
-
core\src\main\resources\config\app\dataaccess\beans-db-server.xml
-
core\src\main\resources\config\app\dataaccess\beans-jpa.xml
-
core\src\main\resources\config\app\logic\beans-logic.xml
-
core\src\main\resources\config\app\security\beans-security-filters.xml
-
core\src\main\resources\config\app\security\beans-security.xml
-
core\src\main\resources\config\app\service\beans-monitoring.xml
-
core\src\main\resources\config\app\service\beans-service.xml
Change detail:
Oasp4j-sample-core\pom.xml
-
Add properties as below in pom.xml .property1 image::images/property1.png["property1", width="450", link="images/property1.png"]
b. If you are using Spring batch add dependency as below:
<dependency>
<groupId> io.oasp.java.modules</groupId>
<artifactId> oasp4j-batch</artifactId>
</dependency>
-
Add dependency for spring-batch-test
<dependency> <groupId>org.springframework.batch</groupId> <artifactId>spring-batch-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>javax.el-api</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> <version>2.10.4</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-ws</artifactId> </dependency>
-
Add Below plugin:
<plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>io.oasp.gastronomy.restaurant.SpringBootApp</mainClass> <layout>ZIP</layout> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins>
-
If you are using Spring batch in application, add BeansBatchConfig.java file to path core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration
-
This file contains bean configuration required for batch jobs like jobrepository,joblauncher etc.
-
-
Add file BeansDozerConfiguration.java to path core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\BeansDozerConfiguration.java
-
This file contain bean configuration related to dozer-mapping.xml
-
-
Add file DefaultRolesPrefixPostProcessor.java to path core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\DefaultRolesPrefixPostProcessor.java
-
This handles post processing for beans related to JSR-250.
-
-
Add file ServiceConfiguration.java to path core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\ServiceConfiguration.java
-
This file contains configuration related to rest web services.
-
-
Add WebConfig.java to path core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\WebConfig.java
-
This file registers a number of filters for web requests.
-
-
Add file WebSecurityConfig.java to path core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\configuration\WebSecurityConfig.java
-
This class provides security configuration based on WebSecurityConfigurerAdapter.
-
-
Add file CsrfRequestMatcher .java to path core\src\main\java\io\oasp\gastronomy\restaurant\general\common\impl\security\CsrfRequestMatcher.java
-
Add file SpringBootApp.java to path core\src\main\java\io\oasp\gastronomy\restaurant\SpringBootApp.java
-
SpringBootApp.java is entry point for Spring boot application.
-
-
Delete below files:
core\src\main\resources\config\app\beans-application.xml core\src\main\resources\config\app\common\beans-common.xml core\src\main\resources\config\app\common\beans-dozer.xml core\src\main\resources\config\app\dataaccess\beans-dataaccess.xml core\src\main\resources\config\app\dataaccess\beans-db-plain.xml core\src\main\resources\config\app\dataaccess\beans-db-server.xml core\src\main\resources\config\app\dataaccess\beans-jpa.xml core\src\main\resources\config\app\logic\beans-logic.xml core\src\main\resources\config\app\security\beans-security-filters.xml core\src\main\resources\config\app\security\beans-security.xml core\src\main\resources\config\app\service\beans-monitoring.xml core\src\main\resources\config\app\service\beans-service.xml
-
Oasp4j-sample-server\pom.xml
-
Add below property in pom.xml as shown in screenshot <properties> <java.version>1.7</java.version> <tomcat.version>7.0.57</tomcat.version> </properties>
-
-
Modify plugin section as below:
<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <execution> <id>npm-install</id> <phase>generate-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>npm</executable> <arguments> <argument>install</argument> </arguments> <workingDirectory>${js.client.dir}</workingDirectory> </configuration> </execution> <execution> <id>tsd-install</id> <phase>generate-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>tsd</executable> <arguments> <argument>install</argument> </arguments> <workingDirectory>${js.client.dir}</workingDirectory> </configuration> </execution> <execution> <id>gulp-clean</id> <phase>generate-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>gulp</executable> <arguments> <argument>clean</argument> </arguments> <workingDirectory>${js.client.dir}</workingDirectory> </configuration> </execution> <execution> <id>gulp-build</id> <phase>generate-sources</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>gulp</executable> <arguments> <argument>build:dist</argument> </arguments> <workingDirectory>${js.client.dir}</workingDirectory> </configuration> </execution> <execution> <id>gulp-test</id> <phase>test</phase> <goals> <goal>exec</goal> </goals> <configuration> <executable>gulp</executable> <arguments> <argument>test</argument> </arguments> <workingDirectory>${js.client.dir}</workingDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build>
-
Add below section to pom.xml:
<build> <resources> <resource> <directory>${project.basedir}/src/main/resources</directory> </resource> <resource> <directory>${js.client.dir}/dist</directory> <targetPath>static</targetPath> </resource> </resources> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>io.oasp.gastronomy.restaurant.SpringBootApp</mainClass> <classifier>bootified</classifier> <finalName>${project.artifactId}</finalName> <layout>WAR</layout> </configuration> </plugin> </plugins> </build>
-
Remove all contents of web.xml. web.xml will look like below :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
</web-app>
Approach 2 :
-
Generate a new, empty, application based on the OASPJ2 archetype with the same groupId, artifactId and package names as the current version.
-
Use this application as base for the new version
-
Copy all packages files and subpackages under <base package>.general from the current version to the new version
-
Add any other dependencies require for your project.
-
Try to execute mvn clean install command.
-
If mvn build is successful try to test it application launching SpringBootApp.java class.
This documentation is licensed under the Creative Commons License (Attribution-NoDerivatives 4.0 International).