Spring boot web app - not able to pick the static content - spring

Spring boot web app with angular bundle was working fine earlier
Then I added a gradle dependency which is a library that is built within my organization to achieve some api calls. And after that the view/angular build is not picking up by spring boot application.
My project structure looks like below
web-app\
src\main\java\
WebApplication.java
\resources\public\index.html
\public\main.5214684651aera5146.js
\public\styles.3asd44654e1asd135fsdf.js
\public\other-angular-build-files
application.properties
I haven't added any view controllers/resource handlers by implementing WebMvcConfigurer. Spring boot was able to pick the index.html file as welcome page and I was able to see the page on http://localhost:8080.
But now it is not working, I have gone though below article and tried with different location of view - public, static, resources, META-INF\resources but nothing workout.
https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot
Can someone help how can I debug this issue or override MVC config so that my spring boot should pick the index.html as the welcome page.

In addition to M. Deinum answer you can try to restrict #ComponentScan only in your app and manually create beans from classes from library

Related

Azure Active Directory in Spring App Without Boot

I have been trying to set up a Spring Web application to use Azure Active Directory.
All the samples that I have found online are based on Spring Boot, is there a simple example that shows setting up spring framework web app only without using Spring Boot?
I am having no luck finding stuff, I am also trying to figure out how to convert all the spring boot autoconfig. Surely there is a sample somewhere that makes it easy to use for a Spring Framework only web-app?
I was able to figure this out somewhat. I'm very new to OAuth so still trying to learn as I go.
Basically I followed the Spring Reference and got things working using the override auto-configuration sections at https://docs.spring.io/spring-security/reference/servlet/oauth2/index.html
It also helped that I updated the Spring Framework versions to the latest and made sure I used the correct dependencies according to that reference site

Spring Boot -1.5.3.Release Version - Enabled with Security Features?

I use Spring Boot - 1.5.3.Release Version for my project. Simply tested my demo application with Actuator and Dev-tools plugin from spring boot initializer site. (Hence I no longer needed to share my POM, as it is default).When I launch my application and try to hit the metrics End Point URL, I get this 401 Unauthorized status (image given below).
Following Options Tried to Bypass this exception
I excluded the SecurityAutoConfiguration on my main Class.
#SpringBootApplication
#EnableAutoConfiguration(exclude= {org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class})
public class MainConfig {
But the above option didn't work.
When I downgrade my Spring-Boot - 1.4.6.RELEASE Version, I didn't get the UnAuthorized Exception. My Application worked like a charm :-)
Questions
Is there any Specific Security Enhancements have been made in the latest release of Spring-Boot (1.5.3.RELEASE Version)?
If at all any enhancements made, let know the community on how to bypass such kind of exceptions?
I also, noticed that when using Spring-boot (1.5.3.RELEASE) it doesn't show any exceptions on startup, even though I have multiple main program in my IDE build path. Is that also an enhancement is spring-boot (1.5.3.RELEASE) version?
Kindly clarify.
From the Spring Boot 1.5 Release Notes:
If you’re upgrading a Spring Boot 1.4 application that doesn’t have dependency on Spring Security and you wish to retain open access to your sensitive endpoints you’ll need to set management.security.enabled to false.

Error using embedded forms with Camunda Spring Boot

I have my process(bpm file) defined as part of the Camunda Spring Boot project. I have a form attached to a Start Event. When I start my process I get "Form failure: Origin is not allowed by Access-Control-Allow-Origin" error.
I have checked Chrome console and found "XMLHttpRequest cannot load app:forms/my-form.html?noCache=1455724524763. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource" error message.
I had packaged the same process outside a Spring Boot project as a normal web app and deployed the war to Camunda Tomcat. It ran without any issue.
The issue happens when I package the same process as part of Camunda Spring Boot project.
Found 2 links describing similar issue but not helping much in terms of resolution.
https://github.com/plexiti/camunda-grails-plugin/issues/47
https://app.camunda.com/jira/browse/CAM-2146
Does Camunda Spring Boot project support embedded form. I have not seen any example of embedded form for Camunda Spring Boot.
I am pretty much stuck. So any help will be much appreciated.
This happens if the Tasklist can not determine the context path of the application. I just experienced that today in a customer training, when I undeployed a war file from a Wildfly.
A workaround could be to use an absolute path in the formKey, e.g. embedded:/mywebapp/forms/my-form.html
We had this problem as well. My coworker left this comment on the github issues of the project that you might find useful: https://github.com/camunda/camunda-bpm-spring-boot-starter/issues/39

Can Jersey resources classes be instantiated in Spring Boot if they're external?

I'm developing a Spring Boot app using Jersey for Rest.
The app will regularly have Rest controller and supporting classes added to it, basically adding small, specific logic at specific endpoints.
I'd like to be able to drop jars containing Jersey controllers into a directory specified by loader.path and have them created (including Spring auto-wiring) by just restarting the server.
Some Jersey resources form the base of the application and these are working fine because I've registered them via a ResourceConfig class but I'd really like to add resources without requiring a rebuild of the app.
Is this possible? I'm failing to get the resources created, I'm not even sure they're in the classpath.
In application.properites, I added:
-Dloader.path=lib/,resources/
and I've copied the jars into these folders, but they don't get instantiated.
Anybody got any ideas?

Grails How to using GSP-Views and REST Webservice in the same Project

I am very new in Groovy and Grails and need some help with my project.
I am using Grails 2.3.8 and the Spring Security Core plugin for Authorization. I created some domain-classes and generated all necessary files with "generate-all"-command. So I can edit my data with the normal gsp-views. This is working fine.
But now I have to extend this project with a REST Webservice (the views to edit data should stay). There are multiple way's to create Webservice I've seen, like Annotations with #Resource on the domain or an extendable RestfulController or I found plugins like Jaxrs.
Could anyone please help me to find out which is the best approach to add a REST Webservice on an existing project which should still work? Or does anyone has a example for something like this?
Thanks in advance,
sbr
EDIT: I'm doing it now with spring security core and acl plugin and the JAXRS plugin for REST api.
To secure the REST api I installed the spring security rest plugin. The authentification over rest api is working fine. BUT now I can't login on my UI Views which are secured by spring security core and acl. There is no error at login, but after click on login I'm never logged in. It is like nothing happens.
Does anyone have an idea what could be wrong or how I have to manage both authentifications?

Resources