Tag Archives: Example

Spring Boot – Create REST API Basic (Hello World)

Hey guys 👋In the last tutorial we have been already learn about create new spring boot application. In this tutorial, we will learn how to create REST API basic in spring boot. Spring Boot – Create REST API Basic (Hello World) First, create new package or folder with name “controller”. Second, create new java class with name “HelloController.java”. After that… Read More »

WebFlux Pagination For Reactive Spring Data

In this example I’m trying to create wrapper for pagination with reactive code in spring 5. I have created simple rest endpoint for finding all entities using spring web-flux and spring data reactive mongoDB with pagination. WebFlux Pagination For Reactive Spring Data In Spring Data 1.0, we have PagingAndSortingRepository which inherits from CrudRepository. In reactive Spring Data, we… Read More »

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 »

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 »