So this is a mix of a couple of howtos. First, we have a simple Spring Boot app that retrieves some data from a MongoDB database that has authentication enabled to access it. Next, we will see how to store secrets in a Vault implementation and then programmatically access it (in our case the user ID and password to access the database).
Category Archives: Spring
Using Spring Boot to invoke ChatGPT/OpenAI API
OpenAI provides us the ability to invoke its features via RESTful APIs. This blog shows how to invoke the API using Spring Boot. There is nothing special here and no OpenAI Java libraries that I use. One can do the same in standard Java (non-spring) or even in more concise code with Nodejs. But here goes a sample with Spring Boot.
Spring Framework API Gateway
An API Gateway serves as the front-door to your APIs providing features such as route matching and forwarding, rate limiting, path rewriting, circuit breaker patterns, security policy management, throttling, API version management, among other features.
AWS Beanstalk (running Spring Boot jar) and Log aggregation with ElasticSearch & Filebeat
Most serious applications (and distributed microservices style architectures) will require to provide a log aggregation & analysis feature to its dev & operations teams. Reviewing log entires from 10s or 100s of server instances is not something to take lightly. Whether you choose to use a commercial product or an open source offering – that does not matter; just make sure you have one available.
Recently I have been deploying applications using AWS Beanstalk. You can definitely configure CloudWatch Logs to send log streams over to AWS ElasticSearch service. Log messages can be routed to a Lambda function which would break the log messages into individual attributes suitable for indexing. I wanted to try a slightly different route where I depend less on CloudWatch Logs and more on open source tools. Enter filebeat on Beanstalk.
Spring Boot service in Docker Container
Updated one of my previous Spring Boot sample service to run within a Docker container – https://github.com/thomasma/quote-service-docker. You can run it locally w/o Docker as a regular Spring Boot app and next run it inside a Docker container. Make sure that you have Docker setup correctly and tested prior to running this app.
Serverless Architecture Style
To discuss Serverless Architecture we need to understand how we got here. From using physical machines we moved to virtual machines (somewhere in between a few brave folks also used linux/solaris containers). The current trend is container technologies such as Docker or CoreOS RKT which allow even more efficient use of resources. Regardless of which you use, we are often required to plan our application infrastructure needs upfront and permanently keep the “servers” running.
Starter Project to build RESTful API’s with SpringMVC
While SpringMVC makes it quite easy to create RESTful services, this starter project adds a few things more. It provides a consistent way to send error messages in json back to the caller and also integrates Spring Security into the mix.
Asynchronous Indexing into ElasticSearch using Spring Integration & ActiveMQ
Here is a slightly modified Architecture on my previous post on Getting Started With ElasticSearch. If you find yourself indexing content constantly (like 100s or even 1000s per minute) you might want to consider an asynchronous architecture towards indexing.
Spring Integration with JMS, ActiveMQ and MongoDB
Extending from some of my previous posts around the 2012 Presidential political contributions, here I will use Spring Integration, ActiveMQ, JMS and Mongodb to load the CSV data into Mongodb.
Running RESTful service on Open Source PaaS Cloudfoundry
Finally got around to deploying one of my old restful applications to the open source PaaS Cloudfoundry.com. I have updated the original post with new instructions at Secure RESTful Services with Maven, Spring, Apache CXF and Spring Security.