Cool portlet development with Spring boot 2 and Angular 8 on Liferay 7.2

For everyone who is looking for working examples of portlets on liferay 7.2 which leverage the power of Angular 8 and Spring boot, I have started a new project on github. For now there is only one basic CRUD example which demonstrates the Spring boot 2 / Angular 8 / liferay integration.

https://github.com/kkaravitis/angular-spring-boot-portlets

Blogs

a suggestion, could add back-end execution instructions ..

congratulations for the initiative!

Hello Marcos,

I updated the Readme.md on github with some instructions on how to download and install the liferay server 7.2 . It is actually one maven command

 

mvn bundle-support:init

but I share and some very helpful links of liferay developer guide.

After the above, if you follow the  rest instructions on README.md file  and start the liferay server (the tomcat basely) you will see the angular/spring boot portlet inside the available portlets of portal. 

Great work. I had a question here. You're using spring boot to fetch the dependencies, but this has nothing to do with the actual spring boot right? 

 

I thought you're starting an application using the Spring boot and reusing that in the OSGI context. ?? 

 

 

If you mean that I am not starting the application by running a main method, yes you are right. The spring boot portlet does not need an embedded tomcat that spring boot offers because it "lives" inside the portlet container which portlet container lives inside the liferay portal which liferay portal lives in tomcat. So if you look at  angular-spring-boot-portlets/wars/books-catalog-portlet/pom.xml

you will see that the spring-boot-starter-tomcat is provided.

 

<dependency>

      <groupId>org.springframework.boot</groupId>

       <artifactId>spring-boot-starter-tomcat</artifactId>

       <scope>provided</scope>

</dependency>

  The above does not mean that the portlet has nothing to do with the actual spring boot ,

it is an actual spring boot application with portlet specific configuration. 

I'd love to see if we can develop portlets which are cross compatible on Spring and OSGI. I know it's crazy, but saves us a lot of time, rather than dependent on a heavy weight container like Liferay. 

 

Development time can be reduced. 

Thanks for sharing that! I'm very new to liferay community and I'm trying to explore the platform as much as I can. One of the POCs I'm doing is related to explore portlets with Angular and Spring Boot - then I find your github code :) One question I have is why you put your "BookController" together with the angular application? I mean, this controller could not be into "book-api" folder? As I mentioned, I'm very new to liferay platform and since I take a look to your code I was wondering about.

You sure can do it. But when you develop it into a portlet (your code being in a controller), you can easily drop it on any page.  One of the main advantages you get it over here is, you get all the power of Liferay portlet. i.e., preferences, on the fly-styling, on the fly-javascript, configuration and most importantly, authentication. There's a lot to this authentication part. For starters, you can switch onto your developer tools in chrome, go to network tab and capture the XHR requests that are made on the page load, observe the request' s made to the controller and see all the parameters. Again, it takes a lot of time and effort to get a solid understanding of this. :-) 

I got it! It makes sense. Thank you for clarifying! And for sure, it does take time to understand every single new platform or framework :)

Hello! I'm new to Liferay, I came from Spring and Microservices Development on AKS, etc.

I'm Technical Lead now (A few months ago) on a project that is a Web Application (Liferay) with a Backend (Microservices) and everything is on AKS. Our Liferay is in a pod on Kubernetes.

 

My question is: we are migrating from 6.2 to 7.2 and the standar development seems to be OSGI (I'm not familiar with this) but I think Spring continues to be easier to develop. What is your recomendation? For example: I need to integrate from my Liferay Application to a KeyVault, a Message Queue, Rest API's, etc. Your post is very useful for me, Thanks. Is a good choice build those librarys and components with Spring or is better to go Osgi?

 

PD: Sorry for my english