I am learning spring boot now, so I download the demo generated by the auto generator in spring boot, but after I import this project into IDEA, something wrong happens, the IDEA can not resolve the SpringBootApplication annotation! So I can not even start the "hello world" with spring boot, can anyone encounter such problems?
I made a mistake while import spring.demo project, I should import it as a maven project so that its dependency can be resolved automatically, but what I have done is that I import it as creating a new project not a maven project , so its class can not be resolved automatically.
Related
I created spring rest API in IntelliJ IDEA using Gradle. When I am using the JDBCTemplate it is not imported in the project, and I get the following message:
package org.springframework.jdbc.core does not exist import org.springframework.jdbc.core.JdbcTemplate; in gradle intellij
Even though this jar file is showing in the external libraries.
I am upgrading the libraries on a system and am implementing spring boot. But, there are some dependencies that have to be added over and above the spring boot starters, and some of these are Spring classes.
How can I tell which library a package and class is coming from? The documentation for the class does not seem to provide this...
If i'm understanding correctly, what i do is looking for Compile Dependencies in the maven repos.
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)
I am building an application using Spring boot framework. Below are my package structure.
com.example.dal -> contains MongoRepositories
com.example.app -> web
application and contains main method to spring
application
The spring framework not able to find repositories if they are in 'com.example.dal' package. But works as expected if they are in 'com.example.app'. I tried different options like below
#ComponentScan("com.example.dal")
#EnableMongoRepositories(basePackages = {"com.example.dal"})
But none of them solves the issue.
Did any one face the same issue?
Or is it an issue with Spring framework ?
I am trying to convert my existing multi-module maven Spring project to Spring Boot project. The reason is make it self contain and follow Martain Fowler's microservices concept.
However, the problem I have encounter is when try to clean build, seems the spring boot is trying to find the Main method from every module, which of course will failed.
Is this feature currently supported by Spring Boot 1.1.6.RELEASE or I did something wrong?
Thanks
It sounds like you've added Spring Boot's Maven plugin to every module in your build – it's what's looking for a main method. You should only add the Spring Boot plugin to a module if its a service that you want to run. If the module's just code that's shared between your services, the Spring Boot plugin isn't needed in that module.