为了账号安全,请及时绑定邮箱和手机立即绑定

spring boot启动失败,是否与maven版本有关

spring boot启动失败,是否与maven版本有关,但是我都已经从3.1.0到3.5.2都试过了。地洞还是失败


G:\installlSoftware\java\jdk1.8.0_25\bin\java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:60251,suspend=y,server=n -javaagent:C:\Users\Administrator\AppData\Local\Temp\capture9970jars\debugger-agent.jar=C:\Users\Administrator\AppData\Local\Temp\capture4902.props -Dfile.encoding=UTF-8 -classpath "G:\installlSoftware\java\jdk1.8.0_25\jre\lib\charsets.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\deploy.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\access-bridge-64.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\cldrdata.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\dnsns.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\jaccess.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\jfxrt.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\localedata.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\nashorn.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\sunec.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\sunjce_provider.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\sunmscapi.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\sunpkcs11.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\ext\zipfs.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\javaws.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\jce.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\jfr.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\jfxswt.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\jsse.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\management-agent.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\plugin.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\resources.jar;G:\installlSoftware\java\jdk1.8.0_25\jre\lib\rt.jar;G:\workspaces_idea\first-app-demo\target\classes;G:\installlSoftware\maven\.m2\repository\org\springframework\boot\spring-boot-starter-webflux\2.0.0.RELEASE\spring-boot-starter-webflux-2.0.0.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\boot\spring-boot-starter\2.0.0.RELEASE\spring-boot-starter-2.0.0.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\boot\spring-boot\2.0.0.RELEASE\spring-boot-2.0.0.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\spring-context\5.0.4.RELEASE\spring-context-5.0.4.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\spring-aop\5.0.4.RELEASE\spring-aop-5.0.4.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\spring-expression\5.0.4.RELEASE\spring-expression-5.0.4.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.0.RELEASE\spring-boot-autoconfigure-2.0.0.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.0.0.RELEASE\spring-boot-starter-logging-2.0.0.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;G:\installlSoftware\maven\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;G:\installlSoftware\maven\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;G:\installlSoftware\maven\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;G:\installlSoftware\maven\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;G:\installlSoftware\maven\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;G:\installlSoftware\maven\.m2\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.0.0.RELEASE\spring-boot-starter-json-2.0.0.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.4\jackson-databind-2.9.4.jar;G:\installlSoftware\maven\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;G:\installlSoftware\maven\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.4\jackson-core-2.9.4.jar;G:\installlSoftware\maven\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.4\jackson-datatype-jdk8-2.9.4.jar;G:\installlSoftware\maven\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.4\jackson-datatype-jsr310-2.9.4.jar;G:\installlSoftware\maven\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.4\jackson-module-parameter-names-2.9.4.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\boot\spring-boot-starter-reactor-netty\2.0.0.RELEASE\spring-boot-starter-reactor-netty-2.0.0.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\io\projectreactor\ipc\reactor-netty\0.7.5.RELEASE\reactor-netty-0.7.5.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-codec-http\4.1.22.Final\netty-codec-http-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-codec\4.1.22.Final\netty-codec-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-handler\4.1.22.Final\netty-handler-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-buffer\4.1.22.Final\netty-buffer-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-transport\4.1.22.Final\netty-transport-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-resolver\4.1.22.Final\netty-resolver-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-handler-proxy\4.1.22.Final\netty-handler-proxy-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-codec-socks\4.1.22.Final\netty-codec-socks-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-transport-native-epoll\4.1.22.Final\netty-transport-native-epoll-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-common\4.1.22.Final\netty-common-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\io\netty\netty-transport-native-unix-common\4.1.22.Final\netty-transport-native-unix-common-4.1.22.Final.jar;G:\installlSoftware\maven\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.7.Final\hibernate-validator-6.0.7.Final.jar;G:\installlSoftware\maven\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;G:\installlSoftware\maven\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;G:\installlSoftware\maven\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\spring-web\5.0.4.RELEASE\spring-web-5.0.4.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\spring-beans\5.0.4.RELEASE\spring-beans-5.0.4.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\spring-webflux\5.0.4.RELEASE\spring-webflux-5.0.4.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\synchronoss\cloud\nio-multipart-parser\1.1.0\nio-multipart-parser-1.1.0.jar;G:\installlSoftware\maven\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;G:\installlSoftware\maven\.m2\repository\org\synchronoss\cloud\nio-stream-storage\1.1.3\nio-stream-storage-1.1.3.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\spring-core\5.0.4.RELEASE\spring-core-5.0.4.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\springframework\spring-jcl\5.0.4.RELEASE\spring-jcl-5.0.4.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\io\projectreactor\reactor-core\3.1.5.RELEASE\reactor-core-3.1.5.RELEASE.jar;G:\installlSoftware\maven\.m2\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;G:\installlSoftware\IntelliJ IDEA Community Edition 2017.3.4\lib\idea_rt.jar" com.imooc.firstappdemo.FirstAppDemoApplication

Connected to the target VM, address: '127.0.0.1:60251', transport: 'socket'


  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::        (v2.0.0.RELEASE)


2018-03-10 15:45:55.045  INFO 7600 --- [           main] c.i.f.FirstAppDemoApplication            : Starting FirstAppDemoApplication on PC-201707161441 with PID 7600 (G:\workspaces_idea\first-app-demo\target\classes started by Administrator in G:\workspaces_idea\first-app-demo)

2018-03-10 15:45:55.058  INFO 7600 --- [           main] c.i.f.FirstAppDemoApplication            : No active profile set, falling back to default profiles: default

2018-03-10 15:45:55.231  INFO 7600 --- [           main] onfigReactiveWebServerApplicationContext : Refreshing org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext@1b11171f: startup date [Sat Mar 10 15:45:55 CST 2018]; root of context hierarchy

2018-03-10 15:45:57.404  INFO 7600 --- [           main] s.w.r.r.m.a.RequestMappingHandlerMapping : Mapped "{[/person/save],methods=[POST]}" onto public com.imooc.firstappdemo.domain.User com.imooc.firstappdemo.controller.UserController.save(java.lang.String)

2018-03-10 15:45:57.508  INFO 7600 --- [           main] o.s.w.r.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.reactive.resource.ResourceWebHandler]

2018-03-10 15:45:57.509  INFO 7600 --- [           main] o.s.w.r.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.reactive.resource.ResourceWebHandler]

2018-03-10 15:45:57.650  INFO 7600 --- [           main] o.s.w.r.r.m.a.ControllerMethodResolver   : Looking for @ControllerAdvice: org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext@1b11171f: startup date [Sat Mar 10 15:45:55 CST 2018]; root of context hierarchy

2018-03-10 15:45:57.999  WARN 7600 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController' defined in file [G:\workspaces_idea\first-app-demo\target\classes\com\imooc\firstappdemo\controller\UserController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.imooc.firstappdemo.repository.UserRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

2018-03-10 15:45:58.015  INFO 7600 --- [           main] ConditionEvaluationReportLoggingListener : 


Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

Disconnected from the target VM, address: '127.0.0.1:60251', transport: 'socket'

2018-03-10 15:45:58.161 ERROR 7600 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 


***************************

APPLICATION FAILED TO START

***************************


Description:


Parameter 0 of constructor in com.imooc.firstappdemo.controller.UserController required a bean of type 'com.imooc.firstappdemo.repository.UserRepository' that could not be found.



Action:


Consider defining a bean of type 'com.imooc.firstappdemo.repository.UserRepository' in your configuration.



Process finished with exit code 1


正在回答

2 回答

@Repository注解是否添加,代码贴一下看看

0 回复 有任何疑惑可以回复我~
#1

a785213720 提问者

代码我已经贴上去了 要是添加@Repository视频里也没加啊
2018-03-12 回复 有任何疑惑可以回复我~
#2

TeMiO 回复 a785213720 提问者

要添加的,要不容器就不会自动加载了,视频里是添加的,回看一下
2018-03-20 回复 有任何疑惑可以回复我~
#3

a785213720 提问者

非常感谢!
2018-03-28 回复 有任何疑惑可以回复我~

public class UserRepository {

   private final ConcurrentMap<Integer,User> repository=new ConcurrentHashMap();
  private final static AtomicInteger idGenerator=new AtomicInteger();
   /**
    * 保存对象
    * @param user
    * @return
    */
   public boolean save (User user){
       Integer id=idGenerator.incrementAndGet();
       user.setId(id);
       return  repository.put(id,user)==null;
   }
}



@RestController
public class UserController {

   private final UserRepository userRepository;

@Autowired
   public UserController (UserRepository userRepository){
       this.userRepository=userRepository;
   }
   @PostMapping("/person/save")
   public User save(@RequestParam String name){
       User user=new User();
       user.setName(name);
       ;
       if (userRepository.save(user)){
           System.out.printf("用户对象:保存成功!\n",user);
       }
       return user;
   }
}

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

spring boot启动失败,是否与maven版本有关

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信