Set Permanent Base PATH Variable on Ubuntu

how to add a directory to the PATH environment variable in linux? Set Permanent Base PATH Variable on Ubuntu Open terminal and type command “sudo su”, then edit bashrc file with nano or vim like below: nano ~/.bashrc After that copy and paste your export PATH into bashrc file then save and exit. Summary The bashrc file will… Read More »

What Is Spring Boot?

Spring Boot is a framework created by Pivotal. Spring Boot is very popular in java community because this framework can make it easy to create stand-alone web application. This framework is designed to simplify the bootstrapping and development of a new Spring application. Developers just need a very little Spring configuration to run web application, because the framework takes an… Read More »

Allow Remote Access On MongoDB

By default MongoDB doesn’t allow remote connections. MongoDB bind to local interface only, it will restrict the remote connections, besides that to allow LAN connections from Application Server open and modify your mongod.conf file like below. In this tutorial i’m using: Debian 9 Linux 64bit x64 MongoDB v4.0.2 Community Server Compute Engine on Google cloud platform Allow Remote Access On MongoDB… Read More »

Spring Data MongoDB – Upsert

In this tutorial i will share to you how to use UpSert operation in spring data mongoDB. If no document that matches the query, a new document is created by combining the query and update object. @Autowired private MongoTemplate mongoTemplate; //search a document that doesn’t exist Query query = new Query(); query.addCriteria(Criteria.where(“id”).is(“cimblo”)); Update update = new Update(); update.set(“age”,… Read More »

Spring Data MongoDB – Save Or Update

In this tutorial you will learn how to save or update data into database using spring data mongoDB. Spring Data MongoDB – Save Or Update First declare “Mongo Template”, then do save or update : @Autowired private MongoTemplate mongoTemplate; Mongo Template Save User user = new User(); user.setName(“cimblo”); user.setAge(99); //save data with save() function mongoTemplate.save(userTest1); Mongo Template Update… Read More »

Spring RestTemplate With Cookie In Header

Spring rest template hit endpoint with cookie in header can be like this: RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.ALL)); headers.add(“Cookie”, “ID=SPRING-JAVA”); HttpEntity entity = new HttpEntity<>(headers); ResponseEntity response = restTemplate.exchange( “https://www.cimblo.com”, HttpMethod.GET, entity, String.class); Spring RestTemplate With Cookie In Header In this example i’m using java 8 and spring boot version 1.5.8 with… Read More »