problem description
under the springboot environment, some classes in the jar package can be automatically assembled, while others can not. What"s going on?
under the springboot environment, some classes in the jar package can be automatically assembled, while others can not. What"s going on?
SpringBoot defaults to injecting all the classes that need to be injected under the root package of the startup class. If you need to inject other package path types, you need to add some attributes scanBasePackages = {"com.package1", "com.package2"}
@ SpringBootApplication
annotation in the startup class.
@SpringBootApplication(scanBasePackages = {"com.package1", "com.package2"})
public class ApplicationRun {
public static void main(String[] args) {
SpringApplication.run(ApplicationRun.class, args);
}
}
attribute scanBasePackages
fill in the path of the package you need to inject
RestTemplate requires @ Bean,
https://www.baeldung.com/rest.
Don't feel that everything is in spring. Some things just need to be injected by yourself
Previous: Postman Import swagger2 link error display: info.title must be included
Next: What is the difference between these two implementations in anti-shaking?
now I want to get a content-type=application json callback data. Oddly enough, I can t get the data using @ RequestBody, as shown in the following code: @Data public class BaiduDocNofityResponse { private String messageId; private String messa...
Why should first get the LocaleContext and RequestAttributes, of the last request saved in the processRequest method of FrameworkServlet in springmvc and finally restore LocaleContext and RequestAttributes in finally ? What s the point of doing this? ...
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder alipay.app_id in value "${alipay.app_id}" Project structure I wrote it in application.properties before it was not configured. I can get the value by using...
the error report is as follows: [ERROR] Failed to execute goal org.mortbay.jetty:jetty-maven-plugin:8.1.16.v20140903:run (default-cli) on project tccglxt4j: Failure: Address already in use: bind-> [Help 1] [ERROR] [ERROR] To see the full stack trace ...
Why did spring fail to automatically match fields? Wechat s front end reads as follows: Java: ...
use springboot + shiro for permission control, and access will be redirected to login.jsp when you are not logged in. If the front and back ends are separated and nginx is used as a proxy, cross-domain problems will occur. : ...
the .xml file of mybatis in spring-boot can only be placed under resources mappper, like this: put together with the interface, not uniformly placed under the resources mapper, separate, easy to manage. thanks! ...
for example, it takes two fields to uniquely determine the login person, but the verification method loadUserByUsername has only one parameter of userName, so it is impossible to pass two parameters. How can login verification be realized? ...
excuse me: String SCOPED_TARGET_NAME_PREFIX = "scopedTarget. "; under what circumstances will this prefix be used? public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMapping implements InitializingBean { ** ...
Front-end proxy server interface controlleraxios postaxiosgetoption tried to implement the filter interface in the background, but it didn t work. Later, I deleted it. Anyway, I have tried many methods that can be found on the Internet . ...
use mybatis to configure custom secondary cache. Using xml annotation can use < cache type= "com.test.dao.MybatisRedisCache " > to successfully use custom cache, but using @ CacheNamespace (implementation = MybatisRedisCache.class) on the dao i...
as a general practice, permissions have been assigned to the corresponding method in the controller layer, for example: PreAuthorize Secured RolesAllowed however, this way to change the code when adjusting permissions, the most annoying, while...
the image of centos7 starting springboot always indicates that the port is occupied, but I m pretty sure that the port is not occupied, and the other port is still occupied which god knows what s going on ...
Import project prompt error: log4j:ERROR setFile (null,true) call failed. java.io.FileNotFoundException: d:classnet.log (the system cannot find the specified path.) ask for the guidance of the gods! ^ _ ^ ...
by default loginPage is login No matter what url path you enter, it will automatically jump to the login page for example, typing: localhost:9090 login 123 in the URL column of the browser will automatically jump to localhost:9090 login, becau...
data stores a field type (as an enumeration). When querying, it needs to be processed separately by using ifelse or switch, for example, 1 is converted to normal. I ve implemented it with the MongoDB statement, but how do I handle it in the springboot ...
the whole project is based on spring cloud . build.gradle configuration of the parent project: group com.xxx.yyy version 0.1.0 buildscript { ext { springBootVersion = 1.5.10.RELEASE } repositories { mavenCe...
spring mvc uses the @ PostMapping,url path similar to this: xxx yyy {uid} runs using the jetty container. when postman simulates a request, the path must be xxx yyy {uid} ? uid=11111 to get the request; but using tomcat only needs xxx yyy 11...
when you visit http: localhost:8080 swagger-ui.html in generating api using swagger2, the page displays: fetching resource list: http: localhost:8080 v2 api-docs; Please wait. returns an empty json string {} when accessing http: localhost:808...
how does SpringBoot access the page? I returned the string "login " at controller. It didn t access the login.html page. Do I need to add thymeleaf dependencies? ...