Git Product home page Git Product logo

micronaut-core's Introduction

Micronaut Framework

Build Status Revved up by Develocity Quality Gate Status

Micronaut Framework is a modern, JVM-based, full stack Java framework designed for building modular, easily testable JVM applications with support for Java, Kotlin and the Groovy language.

The Micronaut framework was originally created by a team who had also worked on the Grails framework. The Micronaut framework takes inspiration from lessons learned over the years building real-world applications from monoliths to microservices using Spring, Spring Boot and the Grails framework. The core team continues to develop and maintain the Micronaut project through the support of the Micronaut Foundation.

Micronaut Framework aims to provide all the tools necessary to build JVM applications including:

  • Dependency Injection and Inversion of Control (IoC)
  • Aspect Oriented Programming (AOP)
  • Sensible Defaults and Auto-Configuration

With Micronaut Framework you can build Message-Driven Applications, Command Line Applications, HTTP Servers and more whilst for Microservices in particular Micronaut Framework also provides:

  • Distributed Configuration
  • Service Discovery
  • HTTP Routing
  • Client-Side Load Balancing

At the same time Micronaut Framework aims to avoid the downsides of frameworks like Spring, Spring Boot and Grails by providing:

  • Fast startup time
  • Reduced memory footprint
  • Minimal use of reflection
  • Minimal use of proxies
  • No runtime bytecode generation
  • Easy Unit Testing

This is achieved by pre-computing the framework infrastructure at compilation time which reduces the logic required at runtime for the application to work.

For more information on using Micronaut Framework see the documentation at micronaut.io

Example Applications

Example Micronaut Framework applications can be found in the Examples repository

Building From Source

To build from source checkout the code and run:

./gradlew publishToMavenLocal

To build the documentation run ./gradlew docs. The documentation is built to build/docs/index.html.

Contributing Code

If you wish to contribute to the development of Micronaut Framework please read the CONTRIBUTING.md

Versioning

Micronaut Framework is using Semantic Versioning 2.0.0. To understand what that means, please see the specification documentation. Exclusions to Micronaut Framework's public API include any classes annotated with @Experimental or @Internal, which reside in the io.micronaut.core.annotation package.

CI

GitHub Actions are used to build Micronaut Framework. If a build fails in master, check the test reports.

micronaut-core's People

Contributors

altro3 avatar alvarosanchez avatar benrhine avatar bogdanoros avatar burtbeckwith avatar croudet avatar ctoestreich avatar dependabot-preview[bot] avatar dependabot[bot] avatar dstepanov avatar graemerocher avatar ilopmar avatar jameskleeh avatar lgathy avatar marceloverdijk avatar mattmoss avatar melix avatar micronaut-build avatar niravassar avatar puneetbehl avatar remkop avatar renovate[bot] avatar sdelamo avatar svishnyakoff avatar timyates avatar wetted avatar willbuck avatar yawkat avatar zacharyklein avatar zendern 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  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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micronaut-core's Issues

@Replaces which does not match @Requires disables bean being replaced.

have an interface RejectionHandler

I have one singleton

@Primary
@Singleton
public class HttpStatusCodeRejectionHandler implements RejectionHandler

then I have this other bean

@Requires(property = SecuritySessionConfigurationProperties.PREFIX + ".enabled")
@Singleton
@Replaces(HttpStatusCodeRejectionHandler.class)
public class SessionSecurityfilterRejectionHandler implements RejectionHandler {

if session security is turned on. I want the next previous to be used instead.

the issue is when session security is not enabled ( the default ). No bean implemented RejectionHandler is injected in the context.

if I remove the @Replaces annotation and don't enable session security the HttpStatusCodeRejectionHandler is used as expected.

How to reproduce?

Uncomment

https://github.com/jeffbrown/micronaut-core/blob/security-jwt/security/src/main/java/io/micronaut/security/session/SessionSecurityfilterRejectionHandler.java#L40

and run tests in security module:

./graldew security:check
You will see them failing because no bean for RejectionHandler is found.

Convert from FullNettyClientHttpResponse to NettyHttpResponse

java.lang.ClassCastException: io.micronaut.http.client.FullNettyClientHttpResponse cannot be cast to io.micronaut.http.server.netty.NettyHttpResponse

How to reproduce.

Clone:

https://github.com/jeffbrown/micronaut-core/tree/jwt

Run security sample app in examples/security.

You will need to start both gateway and security.

examples/security/gateway/src/main/java/example/gateway/Application.java

examples/security/security/src/main/groovy/example/security/SecurityApplication.java

do the next command:

curl -X "POST" "http://localhost:8080/oauth/access_token" \
     -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
     --data-urlencode "grant_type=refresh_token" \
     --data-urlencode "refresh_token=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJldWxlciIsInJvbGVzIjpbIlJPTEVfR1JBSUxTIl0sImlhdCI6MTUyMzk1Nzk0Mn0.ChcgcPsm5Fo0DpjvnAaGrRVoM1ebZl5t8kfUXGraLHI"

Fix support for non-global status handles

The @Error annotation has a global=true flag which works for @Error(SomeException) but not for @Error(status=HttpStatus.NOT_FOUND)

Currently when defining a HTTP status error handler they are always mapped globally. The RouteBuilder interface is missing the ability to define controller specific HTTP status errors

mn -h prints info related to grails

Example:

$ mn -h

Usage (optionals marked with *):'
grails [environment]* [target] [arguments]*'

| Examples:
$ mn dev run-app
$ mn create-app books

Email Notifications From Jenkins

The Jenkins instance should be configured to send email notifications for failed builds and when a broken build returns to health. The build should send email notifications to a fixed list of addresses and if do-able, notify individuals who are associated with commits related to the relevant builds.

Router does not refresh when changing controller path via configuration property

Add HttpStatusException to control flow

Currently if you want to return a custom error status you are forced to return HttpResponse object.

We should instead add a new HttpStatusException that can be thrown.

For example:

Book save(String title) {
        if(title == null) throw new HttpStatusException(HttpStatus.UNPROCESSABLE_ENTITY, "invalid title")
}

Document Endpoints

  • 9.1 Creating Endpoints
    • General description
  • 9.1.1 The Endpoint Annotation
    • Document the available arguments
  • 9.1.2 Endpoint Methods
    • Document @Read, @Write, and @Delete annotations on endpoint methods
  • 9.1.3 Endpoint Configuration
    • Document how the prefix can change, as well as default sensitive enabled and how that plays out. Add a note about how the security project will secure sensitive endpoints.

Failing tests in sample project with Gradle while test pass with IntelliJ Junit

Clone branch `jwt´

https://github.com/jeffbrown/micronaut-core/tree/jwt

Import sample project located under examples/security.

Test pass if you execute tests in security module in IntelliJ with Junit:

napkin 8 18-04-18 2 23 51 pm

However, tests which verify a successful authentication, fail when they are run with Gradle.

example/security$ ./gradlew security:check

It seems AuthenticationProviders are not being loaded correctly in Authenticator.

See:

https://github.com/jeffbrown/micronaut-core/blob/jwt/security/src/main/java/io/micronaut/security/authentication/Authenticator.java#L44

Document Provided Endpoints

9.2 Built-In Endpoints

Ensure all existing endpoints are documented thoroughly including their defaults for enabled/sensitive.

Changing a controller routes causes Test Leakage

I have a branch for allowing configurable Security Endpoints. So that you can say /logout endpoint can be set to salir instead.

Steps to reproduce

Clone:
https://github.com/micronaut-projects/micronaut-core/tree/security-endpoints-configurable-paths

Unignore:
https://github.com/micronaut-projects/micronaut-core/blob/security-endpoints-configurable-paths/security/src/test/groovy/io/micronaut/security/endpoints/LogoutControllerPathConfigurableSpec.groovy

If you run that test in isolation you will see it passes.

If you run the whole suite the test the logout test fails in :

https://github.com/micronaut-projects/micronaut-core/blob/security-endpoints-configurable-paths/security/src/test/groovy/io/micronaut/security/events/EventListenerSpec.groovy

If you run the previous spec in isolation you will see EventListenerSpec passes.

In Suite, EventListenerSpec gets executed after LogoutControllerPathConfigurableSpec.

If you place a debug endpoint in :

https://github.com/micronaut-projects/micronaut-core/blob/security-endpoints-configurable-paths/http-server-netty/src/main/java/io/micronaut/http/server/netty/RoutingInBoundHandler.java#L222

You will see the router still contains the route /salir instead of /logout

Add support for defining configuration driven headers

It should be possible to do the following on a client:

@Header(name="Authorization", value="${some.configuration.value}"
@Client(id="blah")
interface Blah {

}

And it will add the configured header to all outgoing requests

Document Language Support

  • 8 Language Support
    • Missing a general description
  • 8.1 Micronaut for Groovy
    • Document the specific features available for Groovy users
  • 8.2 Micronaut for Kotlin
    • Add a link and a note to how to do the same thing with Maven

Add ability to specify additional config file paths

We should support micronaut.config.files such that you add additional property sources via environment variables or system properties:

java -jar -Dmicronaut.config.files=file:~/myconfig.properties myjar.jar

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.