Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable function is protected #372

Open
lwenxu opened this issue Jul 10, 2021 · 1 comment
Open

enable function is protected #372

lwenxu opened this issue Jul 10, 2021 · 1 comment

Comments

@lwenxu
Copy link

lwenxu commented Jul 10, 2021

when i use it in springboot proj , and use sample case:

   public static JafuApplication app = webApplication(a -> a.beans(b -> b
            .enable(webMvc(s -> s
                    .port(s.profiles().contains("test") ? 8181 : 8080)
                    .router(router -> {

                    }).converters(c -> c
                            .string()
                            .jackson()))));

i get that result , i can't compile that , and i want to call s.initialize() but i can't get bean context any more

image

@lwenxu
Copy link
Author

lwenxu commented Jul 11, 2021

after reading the code , i modified code to this and it works

    public static JafuApplication app = Jafu.webApplication(ioc ->
            ioc
                    .beans(beanDefinition ->
                            beanDefinition.bean(SampleHandler.class)
                                    .bean(SampleService.class)
                                    .bean(Sample.class))
                    .logging(loggingDsl -> loggingDsl.level(LogLevel.DEBUG))
                    .enable(WebMvcServerDsl.webMvc(dsl ->
                            dsl.port(dsl.profiles().contains("test") ? 8181 : 8080)
                                    .router(router -> {
                                        SampleHandler handler = dsl.ref(SampleHandler.class);
                                        router.GET("/sayHello", handler::hello);
                                    })
                                    .converters(c ->
                                            c.string().jackson()
                                    )
                    ))
    );

I strongly recommend that � change the demo code on readme to this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant