Integrate Angular Template With Spring Boot backend application - spring-boot

I am trying to integrate the SB Angular Admin template to a spring boot application. For that, I added the Frontend maven plugin to pom.xml in order to use grunt task runner.
When I clean install, everything works just fine, but when I run the application, all is some html text in blank pages (no design).
What should I do in order to integrate the template and run it alongside with the back-end on the same port on my localhost.

Here's some example of web content management with Spring Boot and AngularJS integration in Spring Boot backend application :
Serving Web Content with Spring MVC
Spring Security and Angular JS

Related

no find web folder in version 2.6.12 in spring boot so no support of jsp and servlet

i am using 2.6.12 version and trying to build web application using spring-tool-suit 4-4.16.0 while creating a web application it have option web but on tick web checkbox we have spring web not web .I have not support of web tool like servlet.

Load a index.html dependent of domain in Spring Boot

I have a Spring Boot project as backend and an Angular project for the frontend.
For now, I use spring to service angular from the static resources, but coming soon I will need to load different angular projects depending on the domain used to access to service.
I can load different static resources by default depending on the domain in Spring Boot?
Example:
resources.add("domain1.com", "resources/static/domain1/");
resources.add("domain2.com", "resources/static/domain2/");

Vaadin 8 Spring Boot QuickTickets Dashboard with Spring MVC

I'm trying to adapt Vaadin Spring Boot QuickTickets Dashboard example with my project needs. Everything is working fine except I'm unable to access another (not Vaadin UI) URLs. For example, I have Spring Boot Actuator endpoint - http://localhost:8080/actuator/health but when I try to access it, the application wrongly redirects me to http://localhost:8080/actuator/health#!dashboard. Pretty much the same behavior with my custom login page(not Vaadin UI) - http://localhost:8080/login. I also unable to access it.
How to correctly setup Vaadin to be able to access Spring Boot Actuator endpoints and my custom login page also?
You need to map the servlet to a different path. I think the problem is that the Vaadin-Servlet is mapped to / an is processing all requests.
Adding the following to you application.properties should do the trick.
vaadin.servlet.urlMapping = /myapp/*
Of course the URL of the app changes accordingly.

Using Spring Boot Thymeleaf by do not run as a web application

I have a Spring Boot application that uses Thymeleaf for email templating. My application is not a web application though.
However, when including the spring boot starter thymeleaf dependency:
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
Spring MVC is transitively included and eventually Servlet.class in my class path signaling that my application is a web application... which then has the undesirable result of running my application in the Tomcat servlet container (by default on port 8080).
How can I use the features of Spring Boot Thymeleaf (such as configuring in a props file ala https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html) without my application running as a web application?
Setting the following property as follows prevents the Spring Boot application from running as web application:
spring.main.web-environment=false

Angular 2, Spring boot , spring security , login form

I have a Front end application that runs on http:// localhost:4200, with angular 2 (I've used angular-cli for generating the project).
The application runs without any problems (I can get and post info from/to database using Angular 2 Http service:
getList () {
return this._http.get("http:// localhost:8080/").map(res => res.json());
}
On the other hand, I have a Back end application running with spring boot on http:// localhost:8080/ (note the ports), that provide a REST Api for my angular 2 application.
Sending requests from http://localhost:4200/ to http://localhost:8080/ works as expected.
Before I've programmed an application with spring framework & angularJS 1, spring security took care of login and security in the same app (maven project).
Now I have two separate applications that are communicating via http (RESTful Api with spring boot , and front end Api with angular 2)
How can I set my login form and where to put it, and how to configure spring security with my angular 2 application?
When you spin up the Angular Application with Angular CLI, your Angular Pages are served by NodeJs in the backend.
You have a couple of options here.
The login can be handled at NodeJS server which can in turn invoke
Spring Boot application to Authenticate and Authorize.(I think, you might need to do some tweaks like using express server instead of lite server. take a look here https://stackoverflow.com/a/37561973/6785908)
After initial development, you can copy over your AngularJS
resources to a Spring MVC (Spring Boot) server and use it to serve
your pages (as well as the rest APIs), just as you were doing
before.
Make the Angular App invoke the spring boot Service (I guess , you
are using the $http.post to submit the form, if that's the case you
can just change the URL so that it can hit spring boot app instead.)
For the production deployment, use nginx/httpd to serve the static
files (AngularJS/CSS etc) and route/proxy all the dynamic request to
the spring boot app.
I would strongly suggest the 3rd option.

Resources