Native microservice - create

Below is shown simple creation of native microservice with map container configured. First step is to create single module structure which is described here. Also add to dependencies library with JLupinAbstractMapApplicationContainer:


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;

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 com.example.impl.ExampleServiceImpl;
import com.example.interfaces.ExampleService;
import com.jlupin.interfaces.configuration.microservice.container.application.JLupinAbstractApplicationContainerProducer;
import com.jlupin.interfaces.container.application.JLupinApplicationContainer;

public class JLupinConfiguration extends JLupinAbstractApplicationContainerProducer {
    public JLupinApplicationContainer produceJLupinApplicationContainer() {
        return new JLupinAbstractMapApplicationContainer() {
            public Map<String, Object> getBeansMap() {
                final Map<String, Object> beans = new HashMap<>();

                beans.put("jLupinRegularExpressionToRemotelyEnabled", getRemotelyBeanList());
                beans.put("exampleService", getExampleServiceBean());

                return beans;

    private ExampleService getExampleServiceBean() {
        return new ExampleServiceImpl();

    private List<String> getRemotelyBeanList() {
        List<String> list = new ArrayList<>();
        return list;

As you can see you don't need to use Spring IOC Container. Instead you can use simple map with beans. 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 container is a bean. And every bean should have it's own name. 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).

  applicationContainerProducerClassName: 'com.example.configuration.JLupinConfiguration'

Full configuration.yml description can be found here.

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