juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcelo Souza Vieira <marcelosou...@gmail.com>
Subject Re: Juneau + Springboot
Date Fri, 23 Nov 2018 17:28:36 GMT
Hello James,

I want to have a version, at least to get the system up.
But I do not know that last week for next week.
It turned out that this week, I had an unforeseen.
My daughter has been hospitalized since Tuesday. I've been in the hospital
with her ever since.
I'm trying to do some things, but actually, I can not even work.
Chances are she'll be discharged tomorrow.
I'll make it clear next week, but I can not guarantee that.
A little more time would be very good.

Em sex, 23 de nov de 2018 às 15:13, James Bognar <jamesbognar@apache.org>
escreveu:

> Hi Marcelo,
>
> I'm close to calling for a vote for Juneau v8.0.  But I'd like to get your
> work included.  Do you think you are close to having something available in
> the next week or so?  Or do you want more time?
>
> We may want to restructure the projects
> - juneau-microservice - Parent pom
>    - juneau-microservice-core - Contains base Microservice class.
>    - juneau-microservice-jetty - Jetty-based microservice that uses
> RestMicroservice.
>    - jueanu-microservice-springboot - Your code.
>    - juneau-microservice-jetty-template - Template starter project.
>    - jueanu-microservice-springboot-template - Template starter project.
>
> Your code would be a valuable addition to the project.
>
> On Wed, Nov 21, 2018 at 3:18 PM James Bognar <jamesbognar@apache.org>
> wrote:
>
>> I've also made the code change to use the registered RestResourceResolver
>> to instantiate any of the objects defined on the @RestResource class.  So
>> any of these can now be defined as Spring beans when using
>> SpringRestResourceResolver.
>>
>> On Wed, Nov 21, 2018 at 2:40 PM Marcelo Souza Vieira <
>> marcelosouzav@gmail.com> wrote:
>>
>>> Ok.
>>> Yes, I'll make the corrections that you indicated. I'm actually altering
>>> it and want to make it work. then I adjust the code to stay in the best
>>> shape. Glad you're getting the way you were thinking.
>>>
>>> Marcelo
>>>
>>> Em qua, 21 de nov de 2018 14:58, James Bognar <jamesbognar@apache.org
>>> escreveu:
>>>
>>>> I've added the following two methods to RestServlet:
>>>>
>>>>    - setRestResourceResolver(RestResourceResolver)
>>>>    - getPath()
>>>>
>>>> Now you can instantiate any subclass of RestServlet with the following
>>>> code:
>>>>
>>>>    @Bean
>>>>    public RootResources root(RestResourceResolver resolver) {
>>>>       return (RootResources)new
>>>> RootResources().setRestResourceResolver(resolver);
>>>>    }
>>>>
>>>>    @Bean
>>>>    public ServletRegistrationBean<RootResources>
>>>> rootRegistration(RootResources root) {
>>>>       return new ServletRegistrationBean<>(root, CONTEXT_ROOT,
>>>> CONTEXT_ROOT+"/", CONTEXT_ROOT+"/"+root.getPath());
>>>>    }
>>>>
>>>> On Wed, Nov 21, 2018 at 11:07 AM James Bognar <jamesbognar@apache.org>
>>>> wrote:
>>>>
>>>>> Awesome work.
>>>>>
>>>>> I have some thoughts.
>>>>>
>>>>> In *@EnabledJuneauIntegration*, you define your root resource as:
>>>>>    *Class<? extends BasicRestServletJenaGroup> rootResources();*
>>>>> There's no reason why the root has to be a group.  It only needs to be
>>>>> anything that extends from *RestServlet*.  The groups are just
>>>>> specialized subclasses of a *RestServlet* that by default render a
>>>>> list of links to child resources defined via *@RestServlet(children)*.
>>>>> See *BasicRestServletGroup* for what I mean.
>>>>> I suggest the following instead:
>>>>>   *Class<? extends RestServlet> resourceClass();*
>>>>>
>>>>> Perhaps you could add *@EnabledJuneauIntegration(path="...") *to
>>>>> identify the servlet path so that you can identify multiple resources?
 And
>>>>> if not specified, you can default to *@RestResource(path)*?
>>>>>
>>>>> This code assumes your class will have a constructor that takes in a
>>>>> *RestResourceResolver*:
>>>>> loadConfig.rootResources().getDeclaredConstructor(RestResourceResolver
>>>>> .class).newInstance(resolver);
>>>>> This isn't likely to be true.  Most of the time there will only be a
>>>>> no-arg constructor (per servlet spec).
>>>>> I can add a *setRestResourceResolver(...)* method to the *RestServlet*
>>>>> class that can be called immediately following construction.  It should
>>>>> simplify this case.
>>>>> loadConfig.rootResources().
>>>>> newInstance().setRestResourceResolver(resolver);
>>>>> It will also eliminate the need to define a RestHook to register the
>>>>> resolver.
>>>>>
>>>>> On a side note, I may want to use the resolver to instantiate any of
>>>>> the types you can define on the *@RestResource* class (e.g. *@RestResource(callHandler,
>>>>> classpathResourceFinder, guards, ...)*) so that any of these can use
>>>>> injection.
>>>>>
>>>>> What currently isn't in place is console support.  i.e. what shows up
>>>>> on the command line when executing your jar file:
>>>>>    Running class 'RestMicroservice' using config file
>>>>> 'my-microservice.cfg'.
>>>>>    Server started on port 10000
>>>>>    List of available commands:
>>>>>       exit -- Shut down service
>>>>>       restart -- Restarts service
>>>>>       help -- Commands help
>>>>>    >
>>>>> You could get this essentially for free by subclassing and
>>>>> instantiating an instance of the *Microservice* class (e.g.
>>>>> *SpringBootMicroservice*).  The *RestMicroservice* class extends this
>>>>> base class and adds Jetty support.  You could use it as an example of
how
>>>>> to subclass this class and start/stop it.
>>>>>
>>>>> I think that's it for now.  Exciting stuff!
>>>>>
>>>>> On Tue, Nov 20, 2018 at 8:25 PM Marcelo Souza Vieira <
>>>>> marcelosouzav@gmail.com> wrote:
>>>>>
>>>>>> Hello guys.
>>>>>>
>>>>>> I am doing some tests to be able to work along with spring-boot.
>>>>>> I made some changes in the structure, I hope you are walking as you
>>>>>> like.
>>>>>> One of the great features of spring-boot is to be very simple, with
>>>>>> very little code, so you can upload a server.
>>>>>> Thinking about this, I created the project "
>>>>>> *juneau-microservice-server-springboot*".
>>>>>> In it will stay the entire integration configuration, avoiding
>>>>>> whoever is doing the integration, need to make the settings manually.
>>>>>> I created the "*EnabledJuneauIntegration*" annotation to enable and
>>>>>> start the settings.
>>>>>>
>>>>>> I changed the project "*juneau-examples-rest-springboot*" to use
>>>>>> this new project.
>>>>>> So when someone else does the integration, just add the annotation
in
>>>>>> this way.
>>>>>>
>>>>>> *@EnabledJuneauIntegration (rootResources = RootResources.class)*
>>>>>>
>>>>>> That all settings will work.
>>>>>>
>>>>>> I was able to go up and call an Juneau endpoint. You're giving me
>>>>>> some trouble, but I still see it.
>>>>>>
>>>>>> I'm taking a while, because I know little Juneau yet, so some
>>>>>> configuration mistakes, it takes a while to find.
>>>>>>
>>>>>> It turned out that my branch is getting big, because as I am testing
>>>>>> things, to see if everything is going to turn out, it will end up
getting
>>>>>> big.
>>>>>> But I'm keeping the branch updated with the master in Juneau.
>>>>>>
>>>>>> If you want to take a look, it's on the link.
>>>>>>
>>>>>> *https://github.com/marcelosv/juneau/tree/dev-marcelo-v-spring
>>>>>> <https://github.com/marcelosv/juneau/tree/dev-marcelo-v-spring>*
>>>>>>
>>>>>> Marcelo Vieira
>>>>>>
>>>>>>

Mime
View raw message