Native microservice - create

Below is shown simple creation of native microservice with Spring IOC container configured. First step is to create single module structure which is described here. Then add classes shown below:

Creating interface

package com.example.interfaces;

public interface ExampleService {
    String getName();

Creating implementation

package com.example.impl;

import com.example.interfaces.ExampleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service(value = "exampleService")
public class ExampleServiceImpl implements ExampleService {
    private final static Logger logger = LoggerFactory.getLogger(ExampleServiceImpl.class);

    public String getName() {"called getName() method");
        return "name";

Interface is optional here (it is a good practice to create interface for every service) but is required for binary communication (generated proxy object is implementing interface). It is also a good practice to put interface in separate jar to not share your internal implementation with the others. More details about logging can be found in Logging chapter.

Remote sharing

package com.example.configuration;

import java.util.ArrayList;
import java.util.List;

public class SpringConfiguration {

    @Bean(name = "jLupinRegularExpressionToRemotelyEnabled")
    public List getRemotelyBeanList() {
        List<String> list = new ArrayList<>();
        return list;

Class is annotated as standard Spring configuration class with component scan (to scan package for used annotations). The important part is a bean named jLupinRegularExpressionToRemotelyEnabled. It is a list of regular expressions which are working as a masks for services available to JLupin Platform. What does it mean? For security reasons not all services are available for remote execution. And decision which are visible outside and which are not is being made by developer. Being specific, every object living inside spring container is a bean. And every bean in Spring container has a name (by default it is class name with first letter downcased). To determine which service should be exposed JLupin Platform takes all beans from application container and then check if this name matches any of regular expressions on bean jLupinRegularExpressionToRemotelyEnabled (this bean is a list). If it matches service is remotely enabled and can be called with remote execution.

You also need to tell JLupin which context to use. You do this by creating proper class and putting it's name in microservice configuration (configuration.yml).

package com.example.configuration;

import com.jlupin.impl.container.application.spring.JLupinAbstractSpringApplicationContainer;
import com.jlupin.interfaces.configuration.microservice.container.application.JLupinAbstractApplicationContainerProducer;
import com.jlupin.interfaces.container.application.JLupinApplicationContainer;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class JLupinConfiguration extends JLupinAbstractApplicationContainerProducer {
    public JLupinApplicationContainer produceJLupinApplicationContainer() {
        return new JLupinAbstractSpringApplicationContainer() {
            public AbstractApplicationContext getAbstractApplicationContext() {
                return new AnnotationConfigApplicationContext(SpringConfiguration.class);

And that's all code you need to write. Go to next section to manually or automatically upload your microservice.