1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Micronaut and Angular 8

Discussão em 'Angular' iniciado por IEE1394, Junho 26, 2025.

  1. IEE1394

    IEE1394 Guest

    i have a Angular App as static content with a micronaut backend (2.0.0-M3). Everything secured with an external keycloak. Language Kotlin on Java 11 and Gradle.

    I followed that Guide: https://guides.micronaut.io/micronaut-spa-react/guide/index.html and also had a look on that Micronaut + Angular : Refresh page

    But at the end i could not bring everything together.

    Having that config works:

    micronaut:
    router:
    static-resources:
    default:
    enabled: true
    mapping: "/**"
    paths: "classpath:static"
    security:
    enabled: true
    intercept-url-map:
    - pattern : /api/**
    access:
    - isAuthenticated()
    - pattern : /static/**
    access:
    - isAnonymous()
    - pattern : /**
    access:
    - isAnonymous()


    That works so far. But if i bring in an IndexController like

    @Controller("/")
    public class IndexController {
    @Inject
    ResourceResolver res;


    @Get("/{[path:[^\\.]*}")
    @Secured(SecurityRule.IS_ANONYMOUS)
    @Produces(MediaType.TEXT_HTML)
    public HttpResponse<?> refresh(HttpRequest<?> request) {
    StreamedFile indexFile = new StreamedFile(res.getResource("classpath:public/index.html").get());
    return HttpResponse.ok(indexFile);
    }
    }


    I get compile errors cause path is not there and if i add an optional path, he could not load the css and javascript files.

    Would be happy if someone could help. Oliver

    Continue reading...

Compartilhe esta Página