Coder Social home page Coder Social logo

clojure-spring-cloud's Introduction

Spring Cloud

Actions Status

Proof of concept Clojure Implementation of Spring Boot Getting Started

This project was created against 'Spring 2.2.5.RELEASE'

Setup

Spring Boot uses its own JarLauncher org.springframework.boot.loader.JarLauncher Maven and Gradle have plugins to package the jar for you, Leiningen does not. So I had to create a custom lein plugin.

Goto - [https://github.com/scotthaleen/lein-spring-boot-jar] and install the plugin locally to compile this project.

Note: for history I have left the custom bash script (./bin/package.sh) used before I created the lein plugin.

Compile

lein spring-boot-jar

Run

Choose a profile either dev and prod and specify it using the spring.profiles.active parameter. There is no default (intentionally) the application will fail to start when no valid profile is not specified.

$ java -jar -Dspring.profiles.active=dev target/boot-spring-cloud-0.1.0-SNAPSHOT.jar
16:04:58.120 [main] INFO spring.cloud.App -
   ____ _       _
  / ___| | ___ (_)_   _ _ __ ___
 | |   | |/ _ \| | | | | '__/ _ \
 | |___| | (_) | | |_| | | |  __/
  \____|_|\___// |\__,_|_|  \___|
              |__/



  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.5.RELEASE)
...


$ curl localhost:8080
Greetings from Clojure!%

$  curl http://localhost:8080/greeting
{"id":1,"content":"Hello, world!"}%

$ curl "http://localhost:8080/greeting?name=User"
{"id":2,"content":"Hello, User!"}%

# Depending on -Dspring.profiles.active={dev,prod}
# Without an active profile the server will fail to start
$ curl http://localhost:8080/env
dev

TODO

  • Spring Boot Lein Package Plugin
  • Spring Profiles example
  • Spring Autowiring magic

Repobeats

Alt

License

Copyright © 2024

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

clojure-spring-cloud's People

Contributors

scotthaleen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

clojure-spring-cloud's Issues

Could not find JarLauncher from jar

Runnig lein spring-boot-jar then java -jar target/boot-spring-cloud-0.1.0-SNAPSHOT.jar results in following error:

Error: Could not find or load main class org.springframework.boot.loader.JarLauncher

The .class file for JarLauncher actually are in target dir.

Is there a fix for that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.