Spring actuator in non mvc application - spring

I added spring-boot-starter-actuator to maven in non mvc application, I added management.endpoints.web.exposure.include=*, when I try to view it on the browser, I get infinity loading, how can I saw metrics?

Related

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

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

migration spring-boot 1 to spring-boot 2.2.5, used JSP

I'm looking to make JSP work in Spring Boot 2.
This is a port of an application running on an old version of Spring Boot 1.
This app worked very well. But as soon as I migrated to Spring Boot 2 .. impossible to access the JSP page (the mapping is done well but impossible to find the JSP !!)
This application ships with tomcat and is delivered as a JAR.
Could someone help me or give me an example?

Java - session sharing between JSP Servlet app war to Spring 4 based Angular2 Rest war

I have found many posts and link on internet, however nothing seems to work. The application is deployed on websphere 9.0. JDK8 Spring 4.3.9
I am unable to share session attributes between two war applications(as checked session id remains same). We have used
(a) IBMApplicationSession instead of HttpSession and
(b) extension to application deployment descriptor . None of the two seems to work.
I have two wars deployed inside an EAR application on IBM WebSphere. One of the war is a simple old style JSP servlet based application, no spring nothing.
From this war we are forwarding request to index.html page of another war application. The second application is an Angular2 Spring 4 based application. The index.htm gets generated when we run ‘ng build’ on the angular application. Along with index page loading we are calling a spring MVC Rest controller. We are trying to access an attribute set in application A servlet in the Rest controller. But the session attributes are not there on other side.
I am simply using
httpSession.setAttribute("key", "value"); in the Servlet class
then I am doing
getServletContext().getContext(anotherContext).getRequestDispatcher(/index.html")
In another application, there are couple of HandleInterceptors and then a Spring MVC annotated RestController is being called on the load of index.html using app.routing.ts
Inside RestController - I am trying to get back the attributes using
httpRequest.getAttribute("key")
httpRequest.getSession().getAttribute("key")
To note that the method is a POST Spring RestContoller and HttpServletRequest and HttpServletResponse and HttpSession are added as method arguments.
I have added HttpSeessionListener to the spring project to track session creation and destruction. Using this I am able to monitor that no new session is being created or destroyed during the time request is being forwarded and it is received in Spring MVC annotated Rest Controller.
Thanks in advance for your inputs on this..

Spring MVC portlet not deploying

I wrote a simple spring mvc portlet and I copied to "deploy" in liferay it is not automatically getting deployed to tomcat's webapp folder.
Further it is deploying only when the tomcat is restarted.
Also the portal having the spring mvc portlet is not automatically refreshed with the new content.
I had to remove it and add it again.
I tried with a simple portlet app and everything happens automatically by default.
Can you tell me what I am missing here in spring mvc portlet app.
Any suggestions would be helpful..
This link from liferay forum might help you.
Just check if the property auto.deploy.interval=0 or auto.deploy.enabled=false is not set.

Using the Spring Security plugin with Grails without the domain model

We're using Grails but with an existing model layer and DAO layer. We have an app written already in Spring MVC, using Spring for IoC and also Security. I'm trying to port the control and view over to Grails as a proof of concept. I have Grails working fine with IoC but am having some trouble getting Grails to work with Spring Security. I'm using 0.5.1 of the Spring security plugin for grails. I have an xml file with all of the spring security settings that work fine with the Spring MVC app, but I'm having trouble getting it to work in Grails. If anyone has any experience using Grails with Spring Security but not using the domain part of the Spring security plugin, then please let me know. Any advice, websites etc would be helpful.
You don't even need the Grails Spring Security Plugin,
You can integrate Spring Security 3 right into Grails as
it all Spring under the hood any way.
You only have to place the Security jars in the lib folder, add two entries into the web.xml and copy over your security applictionContext
This way you can use your existing Spring Security in your grails project
This worked for me.
http://old.nabble.com/Baked-Beans%3A-Securing-Grails-with-Spring-Security-3!-td25339938.html#a25339938
http://blog.jayway.com/2009/11/23/spring-security-for-real-with-grails/comment-page-1
http://knol.google.com/k/grails-with-spring-security#

Resources