Tags

,

Spring Loaded

Main Function: Refresh Java code without restarting server.

Similar: JRebel.

URL: https://github.com/spring-projects/spring-loaded

  • To use Spring Loaded, you have to download the jar and add the following parameters on JVM:
-Djavaagent:ABSOLUTE_PATH/springloaded-1.2.5.RELEASE.jar -noverify
  • On the servers below, the parameters ALSO must be included:
    • JBOSS
-Djboss.modules.system.pkgs=org.jboss.byteman,org.jboss.logmanager,org.springsource
-Djava.util.logging.manager=org.jboss.logmanager.LogManager 
-Xbootclasspath/p:${JBOSS_HOME}/modules/org/jboss/logmanager/main/jboss-logmanager-1.2.0.GA.jar 
-Xbootclasspath/p:${JBOSS_HOME}/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-1.0.0.GA.jar 
-Xbootclasspath/p:${JBOSS_HOME}/modules/org/apache/log4j/main/log4j-1.2.16.jar
  • Wildfly
-Djboss.modules.system.pkgs=org.jboss.byteman,org.springsource

After that, you only need to start the server in Debug Mode and any change on Java Code that is not on method definition or new method/class, you won’t need to restart. It’s recommended to disable the server’s Hot Deploy (Never publish automatically).

PODAM

Main Function: Fill a class (and its dependencies) with random data.

URL: http://devopsfolks.github.io/podam/

Main Functionalities: In addition to being able to fill a class, you can define strategies to generate your data, it supports Bean Validation, generating data for example: Numbers between 3 and 5 (@Min and @Max), and more.

A simple example:

  • Maven dependency
<dependency>
    <groupId>uk.co.jemos.podam</groupId>
    <artifactId>podam</artifactId>
    <version>7.0.4.RELEASE</version>
</dependency>

  • The code
public static void main(String[] args) {
    PodamFactory factory = new PodamFactoryImpl();
    MyPojo myClass = factory.manufacturePojo(MyPojo.class); // Filled class
}

//class MyPojo
public class MyPojo {
    String abc;
    Integer bca;
    Date data;
    //getters and setters
}

Lombok

Main Function: Reduce the amount of Java code.

URL: https://projectlombok.org/

Main Functionalities: Simplify Java things using annotations. Things like Getter, Setter, Constructors, Equals and HashCode, Builder and others.

Lombok configuration comes in two parts: Lombok installation on IDE and the download of the JAR to the app. After downloading lombok.jar , execute:

java -jar lombok.jar

And the maven dependency:

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.16.12</version>
</dependency>

And a simple class example:

//class MyPojo
public class MyPojo {
    @Getter @Setter
    String abc;
    
    public static void main(String[] args) { 
        MyPojo myPojo = new MyPojo();
        myPojo.setAbc("my value");  // I can use setter
        System.out.println(myPojo.getAbc()); // And getter
    }
}

 

Advertisements