IntelliJ IDEA does not display run icon for #RequestMapping - spring-boot

I am in the middle of setting up a Spring Boot application in IntelliJ idea. I was reading about IntelliJ's Spring Boot support and I'm supposed to be able to see a green run icon in the gutter of my #RestController next to my #RequestMapping. The application is working fine and I can even see the mapping in the Run tab under Mappings. I was wondering what I'm missing?
I've created a project using Spring Initializr to show the problem. The issue is reproducible in the DemoController and the project is available on Github

It doesn't work because of the known IntelliJ IDEA bug specific to Spring Boot 2.2.x versions.

Related

Spring Tools 4 for Eclipse info about running app

I am new to Spring and trying to understand a few things. In spring docs read about spring tools and thought to give it a try.
I installed Spring Tools 4.9.0 from Eclipse Marketplace and use it to import a tutorial project (File > New > Other > Import Spring Getting Started Context). Run the app with Boot Dashboard and it works as it should.
Saw in some tutorial videos when the app runs annotations become greenish and if you hover over them you get info like bean id etc.
In my case nothing like that happens. Do i need to configure something in eclipse or am i missing something else?
Thanks in advance.
The feature you are referring to is the "Live Application Information", the user guide section for this is here: https://github.com/spring-projects/sts4/wiki/Live-Application-Information.
In order to have an app showing that live information in the tools, it has to have the spring boot actuators on the classpath: https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html.
Depending on the exact guide that you chose it might not have actuators on the classpath out-of-the-box. In that case, add the actuator dependency to your pom.xml file, do a "Maven -> Update Project" from the context menu and start the app again using the dashboard. Then the green live information highlights should appear.

Mapping missing in Intellij IDEA for Spring Boot application

I am using Spring Boot 2.3.4 , IntelliJ IDEA Ultimate version 2020.2.2 . (Example project can be found here https://github.com/ehmkah/springbootintellij ) I don't see the "mappings" sub-view in IntelliJ IDEA Services View for my springboot-application. It should be right to Health. There are several endpoints configured - they are working I see them in the browser. I guess something is not configured correctly, but I only see errors like
AM Error Loading Project: Cannot load facet Web in EventLog.
Where should I look for errors or are there any known incompatibilities?
Mappings tab as a feature requires Spring MVC bundled plugin. Please make sure it is enabled in Settings(Preferences) | Plugins.
Spring boot application mapping is only accessible with Intellij Ultimate
use plugin Endpoints Explorer, it works well with Intellij Community

HotSwap IntelliJ like Eclipse

In eclipse oxygen my Spring Boot app restarts automatically as soon as I change any Java file. In IntelliJ I did not find a function like this. Can I achieve the same in IntelliJ too? I often read about HotSwap but I cannot get it work with Spring Boot. I also read about spring devtools. But do I really need this if I just want to reload my classes after changes?

Configuring Spring security with spring boot on already created project, IntelliJ

I have previous experience in Spring MVC but I am new to Spring Boot.
I am Using IntelliJ for the first time.
What I noticed is that when you create a Spring boot project with security dependencies added during the time of creation, Then the IDE creates the project already configured With Basic Authentication whereas if I add dependencies to pom.xml after creation, then the application won't get configured with basic authentication automatically.
Can anyone explain this behavior of IntelliJ and can anyone help me with steps for configuring the pre-created project with Basic Authentication?
IntelliJ is using
https://start.spring.io/
to initialise your project. After the project is initialised, the IDE doesn't modify your code in any way. That is the normal behaviour and it is not Spring Boot related.
NOTE: The dependency that you add in your pom.xml is just pulling down that dependency, but if you need to use it you do the code yourself. (More information about Maven: https://en.wikipedia.org/wiki/Apache_Maven)

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.

Resources