Home > Back-end >  Save the children is really don't know how to solve
Save the children is really don't know how to solve

Time:02-10

Recently in an attempt to build your own personal blog, writing the swagger configuration class always announcing the wrong:
Org. Springframework. Beans. Factory. BeanDefinitionStoreException: Failed to load bean class: com. Honey. Swagger. Swagger2; Nested exception is Java. IO. FileNotFoundException: class path resource [org/springframework/boot/autoconfigure/condition/ConditionalOnWebApplication class] always be the opened because it does not exist

Main problem is that I don't know this conditionalOnWebApplication. Class is which step calls... Compiled in the target file is not this file (not the system can't find is really not)
Looking for a lot of similar, basic it is. The property. The XML files can not find, like me. The class files to find only one said to delete the target folder to download... But is also not line, I tried a


Swagger. Java code is as follows:
@ Configuration
@ EnableSwagger2
Public class Swagger2 {
@ Bean
The public Docket createRestApi () {
ParameterBuilder tokenPar=new ParameterBuilder ();
List Pars=new ArrayList (a);
Return new Docket (DocumentationType SWAGGER_2)
ApiInfo (apiInfo ())
The select ()
Apis (RequestHandlerSelectors. BasePackage (com. Honey. "" Controller"))
Paths (PathSelectors. Any ())
.build();
}
Private ApiInfo ApiInfo () {
Return new ApiInfoBuilder ()
. Title (" swagger ")
. The description (" simple to use swagger2 ")
Version (" 1.0 ")
.build();
}
}

CodePudding user response:

You just need to know ConditionalOnWebApplication missing from this class, then check whether there is rely on in this class is not good?
Any IDE has according to the function of the name of the class for class, if can't find that is not in this class in this dependence.

Org. Springframework. Boot
Spring - the boot - autoconfigure
  • Related