Google News
logo
Java Springs - Interview Questions
Can Spring 5 Integrate with the Jdk9 Modularity?
Yes, Spring 5 could integrate with the Jdk9 Modularity. This can be stated as follows :
 
Step 1 : Creating a new class :
 
package com.hello;
public class HelloWorld {
    public String sayHello(){
        return "HelloWorld";
    }
}
 
Step 2 : Creating a new module :
 
module com.hello {
    export com.hello;
}
 
Step 3 : Creating a new Java Project :
 
module com.hello.client {
    requires com.hello;
}
 
Step 4 : Testing the new module :
 
public class HelloWorldClient {
    public static void main(String[] args){
        HelloWorld helloWorld = new HelloWorld();
        log.info(helloWorld.sayHello());
    }
}
Advertisement