You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juneau.apache.org by Marcelo Souza Vieira <ma...@gmail.com> on 2018/11/21 01:25:08 UTC

Juneau + Springboot

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

Re: Juneau + Springboot

Posted by James Bognar <ja...@apache.org>.
Hrm....so new File(".") doesn't resolve to a real location when launched
from Intellij?  What happens if you try to manually set "user.home"?



On Sat, Nov 24, 2018 at 12:42 PM Marcelo Souza Vieira <
marcelosouzav@gmail.com> wrote:

> I figured out why it did not load like settings.
> It was not the "juneau.configFile" fault.
> Well, I was starting the example boot boot directive by intelli, not by
> "java -jar".
>
> This is giving error, because in the "ConfigFileStore" class, this line of
> the problem.
>
> dir = new File (getStringProperty (FILESTORE_directory, ".")).
> getCanonicalFile ();
>
> You can pick up a folder that is with the sample boot project, it is
> picking up a folder that is not loaded, there is not a folder for all the
> projects.
> That's why I did not find the file.
>
> Starting an application with "java -jar" running normally.
>
> I made a manual configuration to test and work by adding a configuration
> below.
>
> System.setProperty ("ConfigFileStore.directory.s", "/ home / marcelo /
> development / projects / juneau / juneau-examples /
> juneau-examples-rest-springboot");
>
> But by uploading an application, note that it works, but the visual
> template is not loaded. So, that has more problems coming up from within
> the IDE.
>
> But, it worked.
> I'm going to do the javadoc here for some classes and already release a
> branch for you to test.
>
> Marcelo
>
> Em sex, 23 de nov de 2018 às 17:34, James Bognar <ja...@apache.org>
> escreveu:
>
>> The Apache mail server doesn't support images or attachments so I can't
>> actually see what the error is.  (really annoying limitation)
>>
>> I'm guessing the problem is that the "juneau.configFile" system property
>> is not set.  That's a relative path to the location of the config file.  I
>> set it like so in my app entry point:
>>
>> public static void main(String[] args) {
>>    System.setProperty("juneau.configFile", "examples.cfg"):
>>    context = SpringApplication.run(App.class, args);
>>
>>
>>
>> On Fri, Nov 23, 2018 at 1:22 PM Marcelo Souza Vieira <
>> marcelosouzav@gmail.com> wrote:
>>
>>> Hello guys
>>>
>>> If anyone can help me.
>>> I have a little problem uploading the system with spring.
>>> I noticed that he was giving the message:
>>> [image: Selection_047.jpg]
>>> I saw that it looks like it can not load the data from the example.cfg.
>>>
>>> [image: Selection_046.jpg]
>>> Quite strange, I could not identify.
>>>
>>> I saw that he finds the file, loads the object. But I do not know why it
>>> does not recover the data.
>>>
>>> Marcelo
>>>
>>>
>>>
>>> Em sex, 23 de nov de 2018 às 15:28, Marcelo Souza Vieira <
>>> marcelosouzav@gmail.com> escreveu:
>>>
>>>> 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 <ja...@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
>>>>>>>>>>
>>>>>>>>>>

Re: Juneau + Springboot

Posted by Marcelo Souza Vieira <ma...@gmail.com>.
I figured out why it did not load like settings.
It was not the "juneau.configFile" fault.
Well, I was starting the example boot boot directive by intelli, not by
"java -jar".

This is giving error, because in the "ConfigFileStore" class, this line of
the problem.

dir = new File (getStringProperty (FILESTORE_directory, ".")).
getCanonicalFile ();

You can pick up a folder that is with the sample boot project, it is
picking up a folder that is not loaded, there is not a folder for all the
projects.
That's why I did not find the file.

Starting an application with "java -jar" running normally.

I made a manual configuration to test and work by adding a configuration
below.

System.setProperty ("ConfigFileStore.directory.s", "/ home / marcelo /
development / projects / juneau / juneau-examples /
juneau-examples-rest-springboot");

But by uploading an application, note that it works, but the visual
template is not loaded. So, that has more problems coming up from within
the IDE.

But, it worked.
I'm going to do the javadoc here for some classes and already release a
branch for you to test.

Marcelo

Em sex, 23 de nov de 2018 às 17:34, James Bognar <ja...@apache.org>
escreveu:

> The Apache mail server doesn't support images or attachments so I can't
> actually see what the error is.  (really annoying limitation)
>
> I'm guessing the problem is that the "juneau.configFile" system property
> is not set.  That's a relative path to the location of the config file.  I
> set it like so in my app entry point:
>
> public static void main(String[] args) {
>    System.setProperty("juneau.configFile", "examples.cfg"):
>    context = SpringApplication.run(App.class, args);
>
>
>
> On Fri, Nov 23, 2018 at 1:22 PM Marcelo Souza Vieira <
> marcelosouzav@gmail.com> wrote:
>
>> Hello guys
>>
>> If anyone can help me.
>> I have a little problem uploading the system with spring.
>> I noticed that he was giving the message:
>> [image: Selection_047.jpg]
>> I saw that it looks like it can not load the data from the example.cfg.
>>
>> [image: Selection_046.jpg]
>> Quite strange, I could not identify.
>>
>> I saw that he finds the file, loads the object. But I do not know why it
>> does not recover the data.
>>
>> Marcelo
>>
>>
>>
>> Em sex, 23 de nov de 2018 às 15:28, Marcelo Souza Vieira <
>> marcelosouzav@gmail.com> escreveu:
>>
>>> 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 <ja...@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 <ja...@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
>>>>>>>>>
>>>>>>>>>

Re: Juneau + Springboot

Posted by James Bognar <ja...@apache.org>.
The Apache mail server doesn't support images or attachments so I can't
actually see what the error is.  (really annoying limitation)

I'm guessing the problem is that the "juneau.configFile" system property is
not set.  That's a relative path to the location of the config file.  I set
it like so in my app entry point:

public static void main(String[] args) {
   System.setProperty("juneau.configFile", "examples.cfg"):
   context = SpringApplication.run(App.class, args);



On Fri, Nov 23, 2018 at 1:22 PM Marcelo Souza Vieira <
marcelosouzav@gmail.com> wrote:

> Hello guys
>
> If anyone can help me.
> I have a little problem uploading the system with spring.
> I noticed that he was giving the message:
> [image: Selection_047.jpg]
> I saw that it looks like it can not load the data from the example.cfg.
>
> [image: Selection_046.jpg]
> Quite strange, I could not identify.
>
> I saw that he finds the file, loads the object. But I do not know why it
> does not recover the data.
>
> Marcelo
>
>
>
> Em sex, 23 de nov de 2018 às 15:28, Marcelo Souza Vieira <
> marcelosouzav@gmail.com> escreveu:
>
>> 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 <ja...@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 <ja...@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 <ja...@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
>>>>>>>>
>>>>>>>>

Re: Juneau + Springboot

Posted by James Bognar <ja...@apache.org>.
Hi Marcelo,

I'm really sorry to hear about that.  Don't worry about the code.  Take
care of your daughter.

I'm too busy with personal issues, so I don't know yet when I'll be ready
to call for a vote.  Also, we can always introduce your code in 8.0.1 so
that we have plenty of time to finalize the design.  In the meantime, I can
organize the projects to make it easy for you to upload your code.

I hope your daughter is better soon.


On Fri, Nov 23, 2018 at 1:22 PM Marcelo Souza Vieira <
marcelosouzav@gmail.com> wrote:

> Hello guys
>
> If anyone can help me.
> I have a little problem uploading the system with spring.
> I noticed that he was giving the message:
> [image: Selection_047.jpg]
> I saw that it looks like it can not load the data from the example.cfg.
>
> [image: Selection_046.jpg]
> Quite strange, I could not identify.
>
> I saw that he finds the file, loads the object. But I do not know why it
> does not recover the data.
>
> Marcelo
>
>
>
> Em sex, 23 de nov de 2018 às 15:28, Marcelo Souza Vieira <
> marcelosouzav@gmail.com> escreveu:
>
>> 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 <ja...@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 <ja...@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 <ja...@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
>>>>>>>>
>>>>>>>>

Re: Juneau + Springboot

Posted by Marcelo Souza Vieira <ma...@gmail.com>.
Hello guys

If anyone can help me.
I have a little problem uploading the system with spring.
I noticed that he was giving the message:
[image: Selection_047.jpg]
I saw that it looks like it can not load the data from the example.cfg.

[image: Selection_046.jpg]
Quite strange, I could not identify.

I saw that he finds the file, loads the object. But I do not know why it
does not recover the data.

Marcelo



Em sex, 23 de nov de 2018 às 15:28, Marcelo Souza Vieira <
marcelosouzav@gmail.com> escreveu:

> 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 <ja...@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 <ja...@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 <ja...@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
>>>>>>>
>>>>>>>

Re: Juneau + Springboot

Posted by Marcelo Souza Vieira <ma...@gmail.com>.
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 <ja...@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 <ja...@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 <ja...@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
>>>>>>
>>>>>>

Re: Juneau + Springboot

Posted by James Bognar <ja...@apache.org>.
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 <ja...@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 <ja...@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
>>>>>
>>>>>

Re: Juneau + Springboot

Posted by James Bognar <ja...@apache.org>.
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 <ja...@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
>>>>
>>>>

Re: Juneau + Springboot

Posted by Marcelo Souza Vieira <ma...@gmail.com>.
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 <ja...@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
>>>
>>>

Re: Juneau + Springboot

Posted by James Bognar <ja...@apache.org>.
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 <ja...@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
>>
>>

Re: Juneau + Springboot

Posted by James Bognar <ja...@apache.org>.
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
>
>