Migration of J2EE to spring boot application

Hello, I'm at my first SWE job and I'm tasked with evaluating migrating away from enterprise services to Spring Boot. I have experience with Spring Boot but I have no idea on how to approach it, it is a huge project with many moving components. Please suggest on how I should approach this.
15 Replies
Matt
Matt9mo ago
1). Look into microservices. 2). Would you be able to provide more details
Reformed
Reformed9mo ago
To move forward I will need to translate ejb to pojo first and test the pojo on existing functions
Matt
Matt9mo ago
However this should be super easy, just evaluate the beans and create a pojo, use lombok to reduce boilerplate code etc. For example this is a simple EJB
import javax.ejb.Stateless;

@Stateless
public class PersonEJB {

private String name;
private int age;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String greet() {
return "Hello, I'm " + name + "!";
}
}
import javax.ejb.Stateless;

@Stateless
public class PersonEJB {

private String name;
private int age;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String greet() {
return "Hello, I'm " + name + "!";
}
}
The pojo for this is as follows.
public class PersonPOJO {

private String name;
private int age;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String greet() {
return "Hello, I'm " + name + "!";
}
}
public class PersonPOJO {

private String name;
private int age;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String greet() {
return "Hello, I'm " + name + "!";
}
}
With lombok you'd do this
@Getter @Setter
public class PersonPOJO {

private String name;
private int age;

public String greet() {
return "Hello, I'm " + name + "!";
}
}
@Getter @Setter
public class PersonPOJO {

private String name;
private int age;

public String greet() {
return "Hello, I'm " + name + "!";
}
}
You'd just do this for every EJB you find and rerun the program. actually it makes sense now why they want to change to spring. Java EE servers are annoying.
Reformed
Reformed9mo ago
I've got something like this ejb @Stateless @Local(NEHandlerLocal.class) @Remote(NEHandlerRemote.class) @TransactionManagement(TransactionManagementType.BEAN) public class NEHandlerBean implements NEHandlerLocal, NEHandlerRemote { public Measurement retrievePM(Node nodeC, Map<String, String> params, Command cmdVal, ExecutionMode mode) throws xxxException { xxxx } @Override // method from interface public OperationStatus getOTDRList(String clientSession, Node node, Map<String, String> params, ExecutionMode mode) throws xxxException { } It implements a interface, how would I go about that in the POJO class? Something like this? public class NEHandlerBean{ public Measurement retrievePM(Node nodeC, Map<String, String> params, Command cmdVal, ExecutionMode mode) throws xxxException { xxxx } public OperationStatus getOTDRList(String clientSession, Node node, Map<String, String> params, ExecutionMode mode) throws xxxException { } } they said it's part of modernization but then that's above my paygrade
Matt
Matt9mo ago
Yeah so... public class NEHandlerPOJO { public Measurement retrievePM(Node nodeC, Map<String, String> params, Command cmdVal, ExecutionMode mode) throws XxxException { // Implementation of the retrievePM method // This method returns a Measurement object and may throw an XxxException // The details of the implementation are represented by "xxxx" } public OperationStatus getOTDRList(String clientSession, Node node, Map<String, String> params, ExecutionMode mode) throws XxxException { // Implementation of the getOTDRList method // This method returns an OperationStatus object and may throw an XxxException // The details of the implementation are not provided in the code snippet } } Is the pojo method.
Reformed
Reformed9mo ago
For the @TransactionManagement, in the POJO class, do I have to something to handle it to maintain the functionality ?
Matt
Matt9mo ago
Pretty much the implementation of that functionality should be handled in the impl class. The annotation used to handle that functionality but now you have to handle it most likely. You're most likely gonna be copying and pasting code all day. You will really be just trying to understand the code to twist it and make ends meet again. Do they allow you to use AI?
Reformed
Reformed9mo ago
yea
Matt
Matt9mo ago
Yeah so check it out.
Matt
Matt9mo ago
No description
Matt
Matt9mo ago
Ask AI some of the questions to understand the code better.
Reformed
Reformed9mo ago
Ok gonna look into what you said, thanks for pointing me in a direction
Matt
Matt9mo ago
Is your company hiring lol
Reformed
Reformed9mo ago
yes
Matt
Matt9mo ago
Check dms
Want results from more Discord servers?
Add your server