问:
Parameter 0 of method standardParameterResolver ... required a single bean, but 2 were found
I have the problem, which I cannot by myself, because of totally zero experience in Spring Boot.

When I'm trying to run my SpringApplication, I am getting this log:
```<code>
"C:\Program Files\Java\jdk1.8.0_111\bin\java" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=54556 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.6\lib\idea_rt.jar=54557:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.6\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_111\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\rt.jar;C:\Users\Volodymyr\IdeaProjects\pgs\target\classes;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-cache\1.5.9.RELEASE\spring-boot-starter-cache-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter\1.5.9.RELEASE\spring-boot-starter-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot\1.5.9.RELEASE\spring-boot-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.9.RELEASE\spring-boot-autoconfigure-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.5.9.RELEASE\spring-boot-starter-logging-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;C:\Users\Volodymyr.m2\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;C:\Users\Volodymyr.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\Volodymyr.m2\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;C:\Users\Volodymyr.m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-context\4.3.13.RELEASE\spring-context-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-beans\4.3.13.RELEASE\spring-beans-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-expression\4.3.13.RELEASE\spring-expression-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-context-support\4.3.13.RELEASE\spring-context-support-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\1.5.9.RELEASE\spring-boot-starter-data-jpa-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-aop\1.5.9.RELEASE\spring-boot-starter-aop-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\hibernate-core\5.0.12.Final\hibernate-core-5.0.12.Final.jar;C:\Users\Volodymyr.m2\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final\hibernate-jpa-2.1-api-1.0.0.Final.jar;C:\Users\Volodymyr.m2\repository\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;C:\Users\Volodymyr.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\Volodymyr.m2\repository\org\jboss\jandex\2.0.0.Final\jandex-2.0.0.Final.jar;C:\Users\Volodymyr.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.0.1.Final\hibernate-commons-annotations-5.0.1.Final.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\hibernate-entitymanager\5.0.12.Final\hibernate-entitymanager-5.0.12.Final.jar;C:\Users\Volodymyr.m2\repository\javax\transaction\javax.transaction-api\1.2\javax.transaction-api-1.2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\data\spring-data-jpa\1.11.9.RELEASE\spring-data-jpa-1.11.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\data\spring-data-commons\1.13.9.RELEASE\spring-data-commons-1.13.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-orm\4.3.13.RELEASE\spring-orm-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-tx\4.3.13.RELEASE\spring-tx-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\Volodymyr.m2\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-aspects\4.3.13.RELEASE\spring-aspects-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-data-rest\1.5.9.RELEASE\spring-boot-starter-data-rest-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\Volodymyr.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;C:\Users\Volodymyr.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;C:\Users\Volodymyr.m2\repository\org\springframework\data\spring-data-rest-webmvc\2.6.9.RELEASE\spring-data-rest-webmvc-2.6.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\data\spring-data-rest-core\2.6.9.RELEASE\spring-data-rest-core-2.6.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\atteo\evo-inflector\1.2.2\evo-inflector-1.2.2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-hateoas\1.5.9.RELEASE\spring-boot-starter-hateoas-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\hateoas\spring-hateoas\0.23.0.RELEASE\spring-hateoas-0.23.0.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\1.5.9.RELEASE\spring-boot-starter-jdbc-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\tomcat-jdbc\8.5.23\tomcat-jdbc-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\tomcat-juli\8.5.23\tomcat-juli-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-jdbc\4.3.13.RELEASE\spring-jdbc-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-security\1.5.9.RELEASE\spring-boot-starter-security-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-aop\4.3.13.RELEASE\spring-aop-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\security\spring-security-config\4.2.3.RELEASE\spring-security-config-4.2.3.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\security\spring-security-web\4.2.3.RELEASE\spring-security-web-4.2.3.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\session\spring-session\1.3.1.RELEASE\spring-session-1.3.1.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-starter\2.0.0.M2\spring-shell-starter-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-core\2.0.0.M2\spring-shell-core-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\jline\jline\3.4.0\jline-3.4.0.jar;C:\Users\Volodymyr.m2\repository\org\jline\jline-terminal-jna\3.4.0\jline-terminal-jna-3.4.0.jar;C:\Users\Volodymyr.m2\repository\net\java\dev\jna\jna\4.2.2\jna-4.2.2.jar;C:\Users\Volodymyr.m2\repository\org\jline\jline-terminal\3.4.0\jline-terminal-3.4.0.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-standard\2.0.0.M2\spring-shell-standard-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-standard-commands\2.0.0.M2\spring-shell-standard-commands-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-shell1-adapter\2.0.0.M2\spring-shell-shell1-adapter-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-jcommander-adapter\2.0.0.M2\spring-shell-jcommander-adapter-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-table\2.0.0.M2\spring-shell-table-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-validation\1.5.9.RELEASE\spring-boot-starter-validation-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.23\tomcat-embed-el-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;C:\Users\Volodymyr.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;C:\Users\Volodymyr.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-web\1.5.9.RELEASE\spring-boot-starter-web-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.9.RELEASE\spring-boot-starter-tomcat-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.23\tomcat-embed-core-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\tomcat-annotations-api\8.5.23\tomcat-annotations-api-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.23\tomcat-embed-websocket-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-web\4.3.13.RELEASE\spring-web-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-webmvc\4.3.13.RELEASE\spring-webmvc-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\com\h2database\h2\1.4.196\h2-1.4.196.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-core\4.3.13.RELEASE\spring-core-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\security\spring-security-core\4.2.3.RELEASE\spring-security-core-4.2.3.RELEASE.jar;C:\Users\Volodymyr.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar" com.hypeofpipe.pgs.PgsApplication</p>

<p>.   ____          _            __ _ _
 /\ / <strong><em>'</em> __ _ <em>(</em>)_ __  __ _ \ \ \ \
( ( )_</strong> | '_ | '<em>| | '</em> / <em>` | \ \ \ \
 \/  <strong></em>)| |<em>)| | | | | || (</em>| |  ) ) ) )
  '  |____| .</strong>|<em>| |</em>|<em>| |</em>__, | / / / /
 =========|_|==============|___/=/<em>/</em>/_/
 :: Spring Boot ::        (v1.5.9.RELEASE)</p>

<p>2017-12-06 16:01:34.437  INFO 6960 --- [           main] com.hypeofpipe.pgs.PgsApplication        : Starting PgsApplication on LAPTOP-LSF16BAT with PID 6960 (C:\Users\Volodymyr\IdeaProjects\pgs\target\classes started by Volodymyr in C:\Users\Volodymyr\IdeaProjects\pgs)
2017-12-06 16:01:34.442  INFO 6960 --- [           main] com.hypeofpipe.pgs.PgsApplication        : No active profile set, falling back to default profiles: default
2017-12-06 16:01:34.557  INFO 6960 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@525f1e4e: startup date [Wed Dec 06 16:01:34 CET 2017]; root of context hierarchy
2017-12-06 16:01:35.971  INFO 6960 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'httpRequestHandlerAdapter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]]
2017-12-06 16:01:36.847  INFO 6960 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$572a4fb0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-12-06 16:01:37.441  INFO 6960 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-12-06 16:01:37.453  INFO 6960 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2017-12-06 16:01:37.456  INFO 6960 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.23
2017-12-06 16:01:37.593  INFO 6960 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-12-06 16:01:37.594  INFO 6960 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3043 ms
2017-12-06 16:01:37.866  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/<em>]
2017-12-06 16:01:37.867  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/</em>]
2017-12-06 16:01:37.867  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/<em>]
2017-12-06 16:01:37.867  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/</em>]
2017-12-06 16:01:37.869  INFO 6960 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2017-12-06 16:01:37.869  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-12-06 16:01:38.448  INFO 6960 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-12-06 16:01:38.463  INFO 6960 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2017-12-06 16:01:38.612  INFO 6960 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
2017-12-06 16:01:38.614  INFO 6960 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2017-12-06 16:01:38.616  INFO 6960 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2017-12-06 16:01:38.691  INFO 6960 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-12-06 16:01:38.885  INFO 6960 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2017-12-06 16:01:39.722  INFO 6960 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2017-12-06 16:01:39.794  INFO 6960 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete
2017-12-06 16:01:39.848  INFO 6960 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-12-06 16:01:41.016  WARN 6960 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'parameterValidationExceptionResultHandler': Unsatisfied dependency expressed through field 'parameterResolvers'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'standardParameterResolver' defined in class path resource [org/springframework/shell/standard/StandardAPIAutoConfiguration.class]: Unsatisfied dependency expressed through method 'standardParameterResolver' parameter 0; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.core.convert.ConversionService' available: expected single matching bean but found 2: mvcConversionService,defaultConversionService
2017-12-06 16:01:41.018  INFO 6960 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-12-06 16:01:41.019  INFO 6960 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2017-12-06 16:01:41.041  INFO 6960 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete
2017-12-06 16:01:41.044  INFO 6960 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2017-12-06 16:01:41.066  INFO 6960 --- [           main] utoConfigurationReportLoggingInitializer : </p>

<p>Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-12-06 16:01:41.074 ERROR 6960 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : </p>

<hr>

<p>APPLICATION FAILED TO START</p>

<hr>

<p>Description:</p>

<p>Parameter 0 of method standardParameterResolver in org.springframework.shell.standard.StandardAPIAutoConfiguration required a single bean, but 2 were found:
    - mvcConversionService: defined by method 'mvcConversionService' in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]
    - defaultConversionService: defined by method 'defaultConversionService' in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]</p>

<p>Action:</p>

<p>Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed</p>

<p>Process finished with exit code 1
```

So, I've tried to disable JMX agent and to add @Primary annotation about my bean. Doesn't work though.

Here's my source code:

pgs_controllers_SubjectsRestController.java

```<code>package com.hypeofpipe.pgs.controllers;

//I've reduced import to fit this post into 30k characters

@RestController
@RequestMapping("/{email}/subjects")
public class SubjectsRestController {

    private final PresenceRepository presenceRepository;

    private final StudentRepository studentRepository;

    private final SubjectRepository subjectRepository;

    private final TeacherRepository teacherRepository;

    @Autowired
    SubjectsRestController(PresenceRepository presenceRepository,
                           StudentRepository studentRepository,
                           SubjectRepository subjectRepository,
                           TeacherRepository teacherRepository){
        this.presenceRepository = presenceRepository;
        this.studentRepository = studentRepository;
        this.subjectRepository = subjectRepository;
        this.teacherRepository = teacherRepository;
    }

    @RequestMapping(method = RequestMethod.GET)
    Collection<Subject> readSubjects(@PathVariable String email){
        if (this.validateUser(email)){ //check it is student
            return this.subjectRepository.findByStudentEmail(email);
        }
        else {
            return this.subjectRepository.findByTeacherEmail(email);
        }
    }

    private boolean validateUser(String userId) {
        char c = userId.charAt(0);
        boolean retBol = false;
        if (Character.getType(c) == Character.getType('s')) {
            retBol = true;
        } else if (Character.getType(c) == Character.getType('t')) {
            retBol = false;
        }

        return retBol;
    }

}
</code>```

pgs_entities_Student.java

```<code>package com.hypeofpipe.pgs.entities;

//I've reduced import to fit this post into 30k characters

@Entity
public class Student {

    @OneToMany(mappedBy = "student")
    public Set<Presence> presences =
            new HashSet<>();

    @Id
    @GeneratedValue
    private Long id;

    @OneToMany
    public Set<Subject> subjects =
            new HashSet<>();

    public Set<Subject> getSubjects() {
        return subjects;
    }

    public Set<Presence> getPresences() {
        return presences;
    }

    public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getSurname() {
        return surname;
    }

    public String getEmail() {
        return email;
    }

    @JsonIgnore
    private String name;
    private String surname;
    private String email;
    private String password;

    public Student(String name, String surname, String email, String password) {
        this.name = name;
        this.surname = surname;
        this.email = email;
        this.password = password;
    }

    Student(){

    }

}
</code>```

pgs_entities_Subject.java

```<code>package com.hypeofpipe.pgs.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;

//I've reduced import to fit this post into 30k characters

@Entity
public class Subject {

    @Id
    @GeneratedValue
    private Long id;

    @OneToMany
    public Set<Presence> presences =
            new HashSet<>();

    @ManyToOne
    private Teacher teacher;

    @ManyToOne
    private Student student;

    public Long getId() {
        return id;
    }

    public Set<Presence> getPresences() {
        return presences;
    }

    public Teacher getTeacher() {
        return teacher;
    }

    public String getName() {
        return name;
    }

    @JsonIgnore
    private String name;

    public Subject(String name,
                   Teacher teacher,
                   Student student){
        this.name = name;
        this.teacher = teacher;
        this.student = student;
    }

    Subject(){

    }

}
</code>```

pgs_entities_Teacher.java

```<code>package com.hypeofpipe.pgs.entities;

//I've reduced import to fit this post into 30k characters

@Entity
public class Teacher {

    @Id

    @GeneratedValue
    private Long id;

    @OneToMany
    public Set<Subject> subjects =
            new HashSet<>();

    public Long getId() {
        return id;
    }

    public Set<Subject> getSubjects() {
        return subjects;
    }

    public String getName() {
        return name;
    }

    public String getSurname() {
        return surname;
    }

    public String getEmail() {
        return email;
    }

    public String getPassword() {
        return password;
    }

    @JsonIgnore
    private String name;
    private String surname;
    private String email;
    private String password;

    public Teacher(String name, String surname, String email, String password) {
        this.name = name;
        this.surname = surname;
        this.email = email;
        this.password = password;
    }

    Teacher(){

    }

}
</code>```

pgs_PgsApplication.java

```<code>package com.hypeofpipe.pgs;

//I've reduced import to fit this post into 30k characters

import java.util.Arrays;
import java.util.Random;

@SpringBootApplication
public class PgsApplication {

    public static void main(String[] args) {
        SpringApplication.run(PgsApplication.class, args);
    }

    @Bean
    @Primary
    CommandLineRunner init(StudentRepository studentRepository,
                           PresenceRepository presenceRepository,
                           SubjectRepository subjectRepository,
                           TeacherRepository teacherRepository) {
        return (evt) -> Arrays.asList(
                "sadampol@gmail.com,sromapor@gmail.com,tbazilev@gmail.com".split(","))
                .forEach(
                        a -> {
                            Student student;
                                student = studentRepository.save(
                                        new Student(
                                                "" + a.substring(0, 2),
                                                "" + a.substring(2, 4),
                                                a,
                                                "password"
                                        )
                                );
                            Teacher teacher =
                                    teacherRepository.save(new Teacher(
                                            "Ba" + a.substring(0, 2),
                                            "Da" + a.substring(2, 4),
                                            a,
                                            "password"
                                    ));
                            Subject subject =
                                    subjectRepository.save(
                                            new Subject(
                                                    "Test" + Math.random(),
                                                    teacher,
                                                    student
                                            )
                                    );
                            Presence presence =
                                    presenceRepository.save(
                                            new Presence(
                                                    student,
                                                    subject,
                                                    new Random().nextBoolean()
                                            )
                                    );
                        });
    }
}
</code>```

pgs_repositories_PresenceRepository.java

```<code>package com.hypeofpipe.pgs.repositories;

//I've reduced import to fit this post into 30k characters

public interface PresenceRepository extends JpaRepository<Presence, Long> {
    Collection<Presence> findByStudentEmail(String email);
}
</code>```

pgs_repositories_StudentRepository.java

```<code>package com.hypeofpipe.pgs.repositories;

//I've reduced import to fit this post into 30k characters

public interface StudentRepository extends JpaRepository<Student, Long> {
    Collection<Student> findByEmail(String email);
    Collection<Student> findByNameAndSurname(String name, String surname);
}
</code>```

pgs_repositories_SubjectRepository.java

```<code>package com.hypeofpipe.pgs.repositories;

//I've reduced import to fit this post into 30k characters

public interface SubjectRepository extends JpaRepository<Subject, Long> {
    Collection<Subject> findByTeacherEmail(String email);
    Collection<Subject> findByStudentEmail(String email);
}
</code>```

pgs_repositories_TeacherRepository.java

```<code>package com.hypeofpipe.pgs.repositories;

//I've reduced import to fit this post into 30k characters

public interface TeacherRepository extends JpaRepository<Teacher, Long> {

    Optional<Teacher> findByEmail(String email);

}
</code>```

I would appreciate any help.

答: I just recreated project in Spring Initialazer and everything is working. Nice.</p>

Body:
I have the problem, which I cannot by myself, because of totally zero experience in Spring Boot.

When I'm trying to run my SpringApplication, I am getting this log:

"C:\Program Files\Java\jdk1.8.0_111\bin\java" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=54556 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.6\lib\idea_rt.jar=54557:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.6\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_111\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\rt.jar;C:\Users\Volodymyr\IdeaProjects\pgs\target\classes;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-cache\1.5.9.RELEASE\spring-boot-starter-cache-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter\1.5.9.RELEASE\spring-boot-starter-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot\1.5.9.RELEASE\spring-boot-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.9.RELEASE\spring-boot-autoconfigure-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-logging\1.5.9.RELEASE\spring-boot-starter-logging-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;C:\Users\Volodymyr.m2\repository\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;C:\Users\Volodymyr.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\Volodymyr.m2\repository\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;C:\Users\Volodymyr.m2\repository\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-context\4.3.13.RELEASE\spring-context-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-beans\4.3.13.RELEASE\spring-beans-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-expression\4.3.13.RELEASE\spring-expression-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-context-support\4.3.13.RELEASE\spring-context-support-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\1.5.9.RELEASE\spring-boot-starter-data-jpa-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-aop\1.5.9.RELEASE\spring-boot-starter-aop-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\hibernate-core\5.0.12.Final\hibernate-core-5.0.12.Final.jar;C:\Users\Volodymyr.m2\repository\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final\hibernate-jpa-2.1-api-1.0.0.Final.jar;C:\Users\Volodymyr.m2\repository\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;C:\Users\Volodymyr.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\Volodymyr.m2\repository\org\jboss\jandex\2.0.0.Final\jandex-2.0.0.Final.jar;C:\Users\Volodymyr.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.0.1.Final\hibernate-commons-annotations-5.0.1.Final.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\hibernate-entitymanager\5.0.12.Final\hibernate-entitymanager-5.0.12.Final.jar;C:\Users\Volodymyr.m2\repository\javax\transaction\javax.transaction-api\1.2\javax.transaction-api-1.2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\data\spring-data-jpa\1.11.9.RELEASE\spring-data-jpa-1.11.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\data\spring-data-commons\1.13.9.RELEASE\spring-data-commons-1.13.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-orm\4.3.13.RELEASE\spring-orm-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-tx\4.3.13.RELEASE\spring-tx-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\Volodymyr.m2\repository\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-aspects\4.3.13.RELEASE\spring-aspects-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-data-rest\1.5.9.RELEASE\spring-boot-starter-data-rest-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\Volodymyr.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.8.10\jackson-databind-2.8.10.jar;C:\Users\Volodymyr.m2\repository\com\fasterxml\jackson\core\jackson-core\2.8.10\jackson-core-2.8.10.jar;C:\Users\Volodymyr.m2\repository\org\springframework\data\spring-data-rest-webmvc\2.6.9.RELEASE\spring-data-rest-webmvc-2.6.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\data\spring-data-rest-core\2.6.9.RELEASE\spring-data-rest-core-2.6.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\atteo\evo-inflector\1.2.2\evo-inflector-1.2.2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-hateoas\1.5.9.RELEASE\spring-boot-starter-hateoas-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\hateoas\spring-hateoas\0.23.0.RELEASE\spring-hateoas-0.23.0.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\1.5.9.RELEASE\spring-boot-starter-jdbc-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\tomcat-jdbc\8.5.23\tomcat-jdbc-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\tomcat-juli\8.5.23\tomcat-juli-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-jdbc\4.3.13.RELEASE\spring-jdbc-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-security\1.5.9.RELEASE\spring-boot-starter-security-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-aop\4.3.13.RELEASE\spring-aop-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\security\spring-security-config\4.2.3.RELEASE\spring-security-config-4.2.3.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\security\spring-security-web\4.2.3.RELEASE\spring-security-web-4.2.3.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\session\spring-session\1.3.1.RELEASE\spring-session-1.3.1.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-starter\2.0.0.M2\spring-shell-starter-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-core\2.0.0.M2\spring-shell-core-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\jline\jline\3.4.0\jline-3.4.0.jar;C:\Users\Volodymyr.m2\repository\org\jline\jline-terminal-jna\3.4.0\jline-terminal-jna-3.4.0.jar;C:\Users\Volodymyr.m2\repository\net\java\dev\jna\jna\4.2.2\jna-4.2.2.jar;C:\Users\Volodymyr.m2\repository\org\jline\jline-terminal\3.4.0\jline-terminal-3.4.0.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-standard\2.0.0.M2\spring-shell-standard-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-standard-commands\2.0.0.M2\spring-shell-standard-commands-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-shell1-adapter\2.0.0.M2\spring-shell-shell1-adapter-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-jcommander-adapter\2.0.0.M2\spring-shell-jcommander-adapter-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\shell\spring-shell-table\2.0.0.M2\spring-shell-table-2.0.0.M2.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-validation\1.5.9.RELEASE\spring-boot-starter-validation-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.23\tomcat-embed-el-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate-validator-5.3.6.Final.jar;C:\Users\Volodymyr.m2\repository\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;C:\Users\Volodymyr.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-web\1.5.9.RELEASE\spring-boot-starter-web-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\1.5.9.RELEASE\spring-boot-starter-tomcat-1.5.9.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.23\tomcat-embed-core-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\tomcat-annotations-api\8.5.23\tomcat-annotations-api-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.23\tomcat-embed-websocket-8.5.23.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-web\4.3.13.RELEASE\spring-web-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-webmvc\4.3.13.RELEASE\spring-webmvc-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\com\h2database\h2\1.4.196\h2-1.4.196.jar;C:\Users\Volodymyr.m2\repository\org\springframework\spring-core\4.3.13.RELEASE\spring-core-4.3.13.RELEASE.jar;C:\Users\Volodymyr.m2\repository\org\springframework\security\spring-security-core\4.2.3.RELEASE\spring-security-core-4.2.3.RELEASE.jar;C:\Users\Volodymyr.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar" com.hypeofpipe.pgs.PgsApplication

.   ____          _            __ _ _
 /\ / ' __ _ ()_ __  __ _ \ \ \ \
( ( )_ | '_ | '| | ' / ` | \ \ \ \
 \/  )| |)| | | | | || (| |  ) ) ) )
  '  |____| .|| ||| |__, | / / / /
 =========|_|==============|___/=///_/
 :: Spring Boot ::        (v1.5.9.RELEASE)

2017-12-06 16:01:34.437  INFO 6960 --- [           main] com.hypeofpipe.pgs.PgsApplication        : Starting PgsApplication on LAPTOP-LSF16BAT with PID 6960 (C:\Users\Volodymyr\IdeaProjects\pgs\target\classes started by Volodymyr in C:\Users\Volodymyr\IdeaProjects\pgs)
2017-12-06 16:01:34.442  INFO 6960 --- [           main] com.hypeofpipe.pgs.PgsApplication        : No active profile set, falling back to default profiles: default
2017-12-06 16:01:34.557  INFO 6960 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@525f1e4e: startup date [Wed Dec 06 16:01:34 CET 2017]; root of context hierarchy
2017-12-06 16:01:35.971  INFO 6960 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'httpRequestHandlerAdapter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]]
2017-12-06 16:01:36.847  INFO 6960 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$572a4fb0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2017-12-06 16:01:37.441  INFO 6960 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2017-12-06 16:01:37.453  INFO 6960 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2017-12-06 16:01:37.456  INFO 6960 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.23
2017-12-06 16:01:37.593  INFO 6960 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2017-12-06 16:01:37.594  INFO 6960 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3043 ms
2017-12-06 16:01:37.866  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/]
2017-12-06 16:01:37.867  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/]
2017-12-06 16:01:37.867  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/]
2017-12-06 16:01:37.867  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/]
2017-12-06 16:01:37.869  INFO 6960 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2017-12-06 16:01:37.869  INFO 6960 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2017-12-06 16:01:38.448  INFO 6960 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2017-12-06 16:01:38.463  INFO 6960 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2017-12-06 16:01:38.612  INFO 6960 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.0.12.Final}
2017-12-06 16:01:38.614  INFO 6960 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2017-12-06 16:01:38.616  INFO 6960 --- [           main] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2017-12-06 16:01:38.691  INFO 6960 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2017-12-06 16:01:38.885  INFO 6960 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2017-12-06 16:01:39.722  INFO 6960 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2017-12-06 16:01:39.794  INFO 6960 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete
2017-12-06 16:01:39.848  INFO 6960 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2017-12-06 16:01:41.016  WARN 6960 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'parameterValidationExceptionResultHandler': Unsatisfied dependency expressed through field 'parameterResolvers'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'standardParameterResolver' defined in class path resource [org/springframework/shell/standard/StandardAPIAutoConfiguration.class]: Unsatisfied dependency expressed through method 'standardParameterResolver' parameter 0; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.core.convert.ConversionService' available: expected single matching bean but found 2: mvcConversionService,defaultConversionService
2017-12-06 16:01:41.018  INFO 6960 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-12-06 16:01:41.019  INFO 6960 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2017-12-06 16:01:41.041  INFO 6960 --- [           main] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete
2017-12-06 16:01:41.044  INFO 6960 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2017-12-06 16:01:41.066  INFO 6960 --- [           main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-12-06 16:01:41.074 ERROR 6960 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

APPLICATION FAILED TO START

Description:

Parameter 0 of method standardParameterResolver in org.springframework.shell.standard.StandardAPIAutoConfiguration required a single bean, but 2 were found:
    - mvcConversionService: defined by method 'mvcConversionService' in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]
    - defaultConversionService: defined by method 'defaultConversionService' in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]

Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

Process finished with exit code 1

So, I've tried to disable JMX agent and to add @Primary annotation about my bean. Doesn't work though.

Here's my source code:

pgs_controllers_SubjectsRestController.java

package com.hypeofpipe.pgs.controllers;

//I've reduced import to fit this post into 30k characters

@RestController
@RequestMapping("/{email}/subjects")
public class SubjectsRestController {

    private final PresenceRepository presenceRepository;

    private final StudentRepository studentRepository;

    private final SubjectRepository subjectRepository;

    private final TeacherRepository teacherRepository;

    @Autowired
    SubjectsRestController(PresenceRepository presenceRepository,
                           StudentRepository studentRepository,
                           SubjectRepository subjectRepository,
                           TeacherRepository teacherRepository){
        this.presenceRepository = presenceRepository;
        this.studentRepository = studentRepository;
        this.subjectRepository = subjectRepository;
        this.teacherRepository = teacherRepository;
    }

    @RequestMapping(method = RequestMethod.GET)
    Collection<Subject> readSubjects(@PathVariable String email){
        if (this.validateUser(email)){ //check it is student
            return this.subjectRepository.findByStudentEmail(email);
        }
        else {
            return this.subjectRepository.findByTeacherEmail(email);
        }
    }

    private boolean validateUser(String userId) {
        char c = userId.charAt(0);
        boolean retBol = false;
        if (Character.getType(c) == Character.getType('s')) {
            retBol = true;
        } else if (Character.getType(c) == Character.getType('t')) {
            retBol = false;
        }

        return retBol;
    }

}

pgs_entities_Student.java

package com.hypeofpipe.pgs.entities;

//I've reduced import to fit this post into 30k characters

@Entity
public class Student {

    @OneToMany(mappedBy = "student")
    public Set<Presence> presences =
            new HashSet<>();

    @Id
    @GeneratedValue
    private Long id;

    @OneToMany
    public Set<Subject> subjects =
            new HashSet<>();

    public Set<Subject> getSubjects() {
        return subjects;
    }

    public Set<Presence> getPresences() {
        return presences;
    }

    public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getSurname() {
        return surname;
    }

    public String getEmail() {
        return email;
    }

    @JsonIgnore
    private String name;
    private String surname;
    private String email;
    private String password;

    public Student(String name, String surname, String email, String password) {
        this.name = name;
        this.surname = surname;
        this.email = email;
        this.password = password;
    }

    Student(){

    }

}

pgs_entities_Subject.java

package com.hypeofpipe.pgs.entities;

import com.fasterxml.jackson.annotation.JsonIgnore;

//I've reduced import to fit this post into 30k characters

@Entity
public class Subject {

    @Id
    @GeneratedValue
    private Long id;

    @OneToMany
    public Set<Presence> presences =
            new HashSet<>();

    @ManyToOne
    private Teacher teacher;

    @ManyToOne
    private Student student;

    public Long getId() {
        return id;
    }

    public Set<Presence> getPresences() {
        return presences;
    }

    public Teacher getTeacher() {
        return teacher;
    }

    public String getName() {
        return name;
    }

    @JsonIgnore
    private String name;

    public Subject(String name,
                   Teacher teacher,
                   Student student){
        this.name = name;
        this.teacher = teacher;
        this.student = student;
    }

    Subject(){

    }

}

pgs_entities_Teacher.java

package com.hypeofpipe.pgs.entities;

//I've reduced import to fit this post into 30k characters

@Entity
public class Teacher {

    @Id

    @GeneratedValue
    private Long id;

    @OneToMany
    public Set<Subject> subjects =
            new HashSet<>();

    public Long getId() {
        return id;
    }

    public Set<Subject> getSubjects() {
        return subjects;
    }

    public String getName() {
        return name;
    }

    public String getSurname() {
        return surname;
    }

    public String getEmail() {
        return email;
    }

    public String getPassword() {
        return password;
    }

    @JsonIgnore
    private String name;
    private String surname;
    private String email;
    private String password;

    public Teacher(String name, String surname, String email, String password) {
        this.name = name;
        this.surname = surname;
        this.email = email;
        this.password = password;
    }

    Teacher(){

    }

}

pgs_PgsApplication.java

package com.hypeofpipe.pgs;

//I've reduced import to fit this post into 30k characters

import java.util.Arrays;
import java.util.Random;

@SpringBootApplication
public class PgsApplication {

    public static void main(String[] args) {
        SpringApplication.run(PgsApplication.class, args);
    }

    @Bean
    @Primary
    CommandLineRunner init(StudentRepository studentRepository,
                           PresenceRepository presenceRepository,
                           SubjectRepository subjectRepository,
                           TeacherRepository teacherRepository) {
        return (evt) -> Arrays.asList(
                "sadampol@gmail.com,sromapor@gmail.com,tbazilev@gmail.com".split(","))
                .forEach(
                        a -> {
                            Student student;
                                student = studentRepository.save(
                                        new Student(
                                                "" + a.substring(0, 2),
                                                "" + a.substring(2, 4),
                                                a,
                                                "password"
                                        )
                                );
                            Teacher teacher =
                                    teacherRepository.save(new Teacher(
                                            "Ba" + a.substring(0, 2),
                                            "Da" + a.substring(2, 4),
                                            a,
                                            "password"
                                    ));
                            Subject subject =
                                    subjectRepository.save(
                                            new Subject(
                                                    "Test" + Math.random(),
                                                    teacher,
                                                    student
                                            )
                                    );
                            Presence presence =
                                    presenceRepository.save(
                                            new Presence(
                                                    student,
                                                    subject,
                                                    new Random().nextBoolean()
                                            )
                                    );
                        });
    }
}

pgs_repositories_PresenceRepository.java

package com.hypeofpipe.pgs.repositories;

//I've reduced import to fit this post into 30k characters

public interface PresenceRepository extends JpaRepository<Presence, Long> {
    Collection<Presence> findByStudentEmail(String email);
}

pgs_repositories_StudentRepository.java

package com.hypeofpipe.pgs.repositories;

//I've reduced import to fit this post into 30k characters

public interface StudentRepository extends JpaRepository<Student, Long> {
    Collection<Student> findByEmail(String email);
    Collection<Student> findByNameAndSurname(String name, String surname);
}

pgs_repositories_SubjectRepository.java

package com.hypeofpipe.pgs.repositories;

//I've reduced import to fit this post into 30k characters

public interface SubjectRepository extends JpaRepository<Subject, Long> {
    Collection<Subject> findByTeacherEmail(String email);
    Collection<Subject> findByStudentEmail(String email);
}

pgs_repositories_TeacherRepository.java

package com.hypeofpipe.pgs.repositories;

//I've reduced import to fit this post into 30k characters

public interface TeacherRepository extends JpaRepository<Teacher, Long> {

    Optional<Teacher> findByEmail(String email);

}

I would appreciate any help.


来源: stackexchange

问:
Kotlin start Application crash
my application is built with kotlin,here is my build.gradle file:

```<code>compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
</code>```

and my workspace's build.gradle file:

```<code>ext.kotlin_version = '1.1.3-2'
ext.kotlin_plugin_version = '1.1.1'
dependencies {
    classpath "io.realm:realm-gradle-plugin:3.4.0"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_plugin_version"
}
</code>```

in my project,I already use java8 with jack, so the gradle-plugin version can only be 1.1.1

when I start my application, it crashes randomly,here is the log:

```<code>FATAL EXCEPTION: main
Process: com.ss.android.caijing.stock.debug, PID: 31962
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
   at com.ss.android.caijing.stock.main.MainActivity.initData(MainActivity.kt:33)
   at com.ss.android.caijing.stock.base.BaseActivity.onCreate(BaseActivity.java:25)
   at android.app.Activity.performCreate(Activity.java:6367)
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
   at com.bytedance.frameworks.plugin.hook.InstrumentationHook$PluginInstrumentation.callActivityOnCreate(InstrumentationHook.java:248)
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
   at android.app.ActivityThread.access$900(ActivityThread.java:165)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:150)
   at android.app.ActivityThread.main(ActivityThread.java:5621)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/com.ss.android.caijing.stock.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ss.android.caijing.stock.debug-1/lib/arm64, /data/app/com.ss.android.caijing.stock.debug-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
   at com.ss.android.caijing.stock.main.MainActivity.initData(MainActivity.kt:33)
   at com.ss.android.caijing.stock.base.BaseActivity.onCreate(BaseActivity.java:25)
   at android.app.Activity.performCreate(Activity.java:6367)
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
   at com.bytedance.frameworks.plugin.hook.InstrumentationHook$PluginInstrumentation.callActivityOnCreate(InstrumentationHook.java:248)
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
   at android.app.ActivityThread.access$900(ActivityThread.java:165)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:150)
   at android.app.ActivityThread.main(ActivityThread.java:5621)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Suppressed: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics not found
   at com.bytedance.frameworks.plugin.core.DelegateClassLoader.findClass(DelegateClassLoader.java:137)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
Suppressed: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
   at java.lang.Class.classForName(Native Method)
   at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
   at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Caused by: java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invoke(Native Method)
   at com.bytedance.frameworks.plugin.core.DelegateClassLoader.findClass(DelegateClassLoader.java:60)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/com.ss.android.caijing.stock.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ss.android.caijing.stock.debug-1/lib/arm64, /data/app/com.ss.android.caijing.stock.debug-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

 private var mPagerAdapter: MainFragmentAdapter? = null
</code>```

override

```<code>fun initData() { mPagerAdapter = MainFragmentAdapter(supportFragmentManager, this) }
</code>```

the crash happens in the init of the mPageAdapter, the constructor of the MainFragmentPagerAdapter is below:

```<code>class MainFragmentAdapter : FragmentPagerAdapter { private val mContext:     Context constructor(fm: FragmentManager, context: Context) : super(fm) { mContext = context }
</code>```

can somebody help me out,thx a lot!

答:
Adding the following as an app-level dependency fixed it for me:

```<code>implementation "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
</code>```

--- EDIT ---

This has now been superseded by:

```<code>implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
</code>```

ContentLicense: CC BY-SA 3.0

Title: Kotlin start Application crash

Body:
my application is built with kotlin,here is my build.gradle file:

compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

and my workspace's build.gradle file:

ext.kotlin_version = '1.1.3-2'
ext.kotlin_plugin_version = '1.1.1'
dependencies {
    classpath "io.realm:realm-gradle-plugin:3.4.0"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_plugin_version"
}

in my project,I already use java8 with jack, so the gradle-plugin version can only be 1.1.1

when I start my application, it crashes randomly,here is the log:

FATAL EXCEPTION: main
Process: com.ss.android.caijing.stock.debug, PID: 31962
java.lang.NoClassDefFoundError: Failed resolution of: Lkotlin/jvm/internal/Intrinsics;
   at com.ss.android.caijing.stock.main.MainActivity.initData(MainActivity.kt:33)
   at com.ss.android.caijing.stock.base.BaseActivity.onCreate(BaseActivity.java:25)
   at android.app.Activity.performCreate(Activity.java:6367)
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
   at com.bytedance.frameworks.plugin.hook.InstrumentationHook$PluginInstrumentation.callActivityOnCreate(InstrumentationHook.java:248)
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
   at android.app.ActivityThread.access$900(ActivityThread.java:165)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:150)
   at android.app.ActivityThread.main(ActivityThread.java:5621)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/com.ss.android.caijing.stock.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ss.android.caijing.stock.debug-1/lib/arm64, /data/app/com.ss.android.caijing.stock.debug-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
   at com.ss.android.caijing.stock.main.MainActivity.initData(MainActivity.kt:33)
   at com.ss.android.caijing.stock.base.BaseActivity.onCreate(BaseActivity.java:25)
   at android.app.Activity.performCreate(Activity.java:6367)
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
   at com.bytedance.frameworks.plugin.hook.InstrumentationHook$PluginInstrumentation.callActivityOnCreate(InstrumentationHook.java:248)
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511)
   at android.app.ActivityThread.access$900(ActivityThread.java:165)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1375)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:150)
   at android.app.ActivityThread.main(ActivityThread.java:5621)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Suppressed: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics not found
   at com.bytedance.frameworks.plugin.core.DelegateClassLoader.findClass(DelegateClassLoader.java:137)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
Suppressed: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
   at java.lang.Class.classForName(Native Method)
   at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
   at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
Caused by: java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invoke(Native Method)
   at com.bytedance.frameworks.plugin.core.DelegateClassLoader.findClass(DelegateClassLoader.java:60)
Caused by: java.lang.ClassNotFoundException: Didn't find class "kotlin.jvm.internal.Intrinsics" on path: DexPathList[[zip file "/data/app/com.ss.android.caijing.stock.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.ss.android.caijing.stock.debug-1/lib/arm64, /data/app/com.ss.android.caijing.stock.debug-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)

 private var mPagerAdapter: MainFragmentAdapter? = null

override

fun initData() { mPagerAdapter = MainFragmentAdapter(supportFragmentManager, this) }

the crash happens in the init of the mPageAdapter, the constructor of the MainFragmentPagerAdapter is below:

class MainFragmentAdapter : FragmentPagerAdapter { private val mContext:     Context constructor(fm: FragmentManager, context: Context) : super(fm) { mContext = context }

can somebody help me out,thx a lot!

Body:
Adding the following as an app-level dependency fixed it for me:

implementation "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"

--- EDIT ---

This has now been superseded by:

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"


问:
Resolving a Slack user ID without mentioning the user
According to the Slack docs, I should use <@W123> syntax.  However, this turns into @joe, which alerts joe that someone messaged them. Is there any syntax like <W123> that resolves to just the user's display name?

(I am aware that I could use user.info, but so far I've avoided making any API calls and I was hoping I could keep that going.)

答: Got a response from @SlackAPI on Twitter.  Unfortunately, there is no markdown-y way to do this.  On the plus side, they have a good sense of humor.</p>


问:
whay bootstrap selectpicker not working in laravel collective?
```<code>{!! Form::select('size', ['L' => 'Large', 'S' => 'Small'], null,
['placeholder' => 'Pick a size...','clase'=>'selectpicker form-control']) !!}
</code>```

答:
You have a typo in the word class.  Try:

```<code>{!! Form::select('size', ['L' => 'Large', 'S' => 'Small'], null,
['placeholder' => 'Pick a size...','class'=>'selectpicker form-control']) !!}
</code>```

Body:
You have a typo in the word class.  Try:

{!! Form::select('size', ['L' => 'Large', 'S' => 'Small'], null,
['placeholder' => 'Pick a size...','class'=>'selectpicker form-control']) !!}


问:
What is the required allocation of a char that is to be converted to an int from stdin
Hear me C gods, I am but a newbie:

Trying to get an input char that will be a small int, convert it to an int and then print it out again.

```<code>#include <stdio.h>
#include <ctype.h>

int main(void) {
    char x[1]; /* I assumed this is OK because my input is between -127 and 127 */;
    printf("Input your integer\n");
    fgets(x, 1, stdin);
    printf("you entered %s\n", x);
    if (isdigit(x)) {
        int i = x - '0';
        printf("success it's:%d \n", i);
        printf("two times %d is %d\n", i, i*2);
    } else {
        printf("YOU DID NOT INPUT AN INTEGER\n");
    }
    return 0;
}
</code>```

What is the correct allocation of char x[1] for this to work? In the end my program just screams at me.

EDIT

thanks to an answer below, this works:

```<code>#include <stdio.h>
#include <ctype.h>

int main(void) {
    char x[2];
    printf("Input your integer\n");
    fgets(x, 2, stdin);
    printf("you entered %s\n", x);
    if (isdigit(x[0])) {
        int i = x[0] - '0';
        printf("success it's:%d \n", i);
        printf("two times %d is %d\n", i, i*2);
    } else {
        printf("YOU DID NOT INPUT AN INTEGER\n");
    }
    return 0;
}
</code>```

It seems I needed to account for an additional char \0, once that was done in the allocation, then I could use isdigit by indexing the char array and do the same for the conversion. Whether this is recommended use though I'm unsure(I suspect not).

答:
Your input does not get automatically converted into an int. For example if your user typed in "67 (enter)", what you should expect in stdin is char array of {'6', '7', '\n', '\0'}.

What you want to do is to allocate a big enough array, save the user input from stdin, then use atoi to do the conversion.

Body:
Hear me C gods, I am but a newbie:

Trying to get an input char that will be a small int, convert it to an int and then print it out again.

#include <stdio.h>
#include <ctype.h>

int main(void) {
    char x[1]; /* I assumed this is OK because my input is between -127 and 127 */;
    printf("Input your integer\n");
    fgets(x, 1, stdin);
    printf("you entered %s\n", x);
    if (isdigit(x)) {
        int i = x - '0';
        printf("success it's:%d \n", i);
        printf("two times %d is %d\n", i, i*2);
    } else {
        printf("YOU DID NOT INPUT AN INTEGER\n");
    }
    return 0;
}

What is the correct allocation of char x[1] for this to work? In the end my program just screams at me.

EDIT

thanks to an answer below, this works:

#include <stdio.h>
#include <ctype.h>

int main(void) {
    char x[2];
    printf("Input your integer\n");
    fgets(x, 2, stdin);
    printf("you entered %s\n", x);
    if (isdigit(x[0])) {
        int i = x[0] - '0';
        printf("success it's:%d \n", i);
        printf("two times %d is %d\n", i, i*2);
    } else {
        printf("YOU DID NOT INPUT AN INTEGER\n");
    }
    return 0;
}

It seems I needed to account for an additional char \0, once that was done in the allocation, then I could use isdigit by indexing the char array and do the same for the conversion. Whether this is recommended use though I'm unsure(I suspect not).


问:
Check if switch from SettingsActivity is on
How can I check in my MainActivity if the on/off switch is on in the SettingsActivity. I want to check if the switch is on and if it is, I want to do something. How do I do this so that this preference is saved and will be the same when you restart the app?

Here is a part of my SettingsActivity with a switch

```<code>static int audio;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class GeneralPreferenceFragment extends PreferenceFragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_general);
        setHasOptionsMenu(true);

        bindPreferenceSummaryToValue(findPreference("example_text"));
        bindPreferenceSummaryToValue(findPreference("example_list"));

        Preference switchPref = (Preference) findPreference("audio_switch");

        switchPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
            @Override
            public boolean onPreferenceChange(Preference preference, Object o) {

                boolean isOn = (boolean) o;

                if (isOn) {
                    audio = 1;

                }else{
                    audio = 0;

                }
                    return true;
                }
            });
        }
</code>```

答:
I usually do the following:

To save your setting
(Put this in a save() method you call when you click a button or something in your settings activity)

```<code>SharedPreferences options =
getSharedPreferences("optionsPreference",
contextOfSettings.MODE_PRIVATE);
options.edit().putString("key", "value").apply();
</code>```

In order to do this you need to add this in your settings activity

As a global variable in settings

```<code>public static Context contextOfSettings;
</code>```

And this method in your onCreate of settings

```<code>@Override
protected void onCreate {
contextOfSettings = getApplicationContext();
}
</code>```

And import it in your main activity by typing context of settings somewhere and then import it by pressing alt+enter
Like this:

```<code>import com.SettingsActivity.contextOfSettings;
</code>```

Then you can get your saved value (which will still be saved even if you close your app) with this in your on create of your MainActivity

```<code>SharedPreferences options = getSharedPreferences("optionsPreference", contextOfSettings.MODE_PRIVATE);
String savedValue = options.getString("key", "defaultValue");
</code>```

This String can have the values true and false which you can set with checkBox.isChecked() in combination with an if-statement

Body:
How can I check in my MainActivity if the on/off switch is on in the SettingsActivity. I want to check if the switch is on and if it is, I want to do something. How do I do this so that this preference is saved and will be the same when you restart the app?

Here is a part of my SettingsActivity with a switch

static int audio;
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class GeneralPreferenceFragment extends PreferenceFragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.pref_general);
        setHasOptionsMenu(true);

        bindPreferenceSummaryToValue(findPreference("example_text"));
        bindPreferenceSummaryToValue(findPreference("example_list"));

        Preference switchPref = (Preference) findPreference("audio_switch");

        switchPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
            @Override
            public boolean onPreferenceChange(Preference preference, Object o) {

                boolean isOn = (boolean) o;

                if (isOn) {
                    audio = 1;

                }else{
                    audio = 0;

                }
                    return true;
                }
            });
        }

Body:
I usually do the following:

To save your setting
(Put this in a save() method you call when you click a button or something in your settings activity)

SharedPreferences options =
getSharedPreferences("optionsPreference",
contextOfSettings.MODE_PRIVATE);
options.edit().putString("key", "value").apply();

In order to do this you need to add this in your settings activity

As a global variable in settings

public static Context contextOfSettings;

And this method in your onCreate of settings

@Override
protected void onCreate {
contextOfSettings = getApplicationContext();
}

And import it in your main activity by typing context of settings somewhere and then import it by pressing alt+enter
Like this:

import com.SettingsActivity.contextOfSettings;

Then you can get your saved value (which will still be saved even if you close your app) with this in your on create of your MainActivity

SharedPreferences options = getSharedPreferences("optionsPreference", contextOfSettings.MODE_PRIVATE);
String savedValue = options.getString("key", "defaultValue");

This String can have the values true and false which you can set with checkBox.isChecked() in combination with an if-statement


问:
How to read pickle files without taking up a lot of memory
Currently I have a loop that contains:

```<code>df = pandas.read_pickle(filepath)
</code>```

the files are ~ 100 mb. However since it is looping through these many times, it is taking up a lot of memory and then eventually I get a memory error. Is there a way to do this where I can close the file once I get the dataframe?

My code is correct because I've tested it with less files. I just want an alternative to reading large pickle files without taking up too much memory after I read it.

答:
```<code>del df
gc.collect()
</code>```

Erase reference, and garbage colector.

Edit, this erase your dataframe from memory, you can not close the file, take the info and dont use ram.

Body:
Currently I have a loop that contains:

df = pandas.read_pickle(filepath)

the files are ~ 100 mb. However since it is looping through these many times, it is taking up a lot of memory and then eventually I get a memory error. Is there a way to do this where I can close the file once I get the dataframe?

My code is correct because I've tested it with less files. I just want an alternative to reading large pickle files without taking up too much memory after I read it.

Body:
del df
gc.collect()

Erase reference, and garbage colector.

Edit, this erase your dataframe from memory, you can not close the file, take the info and dont use ram.


问:
How to create multiple autocomplete in an input field based on a sentence structure?
The sentence structure of my autocomplete is:

<Occupation> <for> <time period>

Example:

Student for 5 years

Teacher for 2 years

In the database, I have a column containing a list of occupations. With jQuery UI autocomplete, I populate the first two sections   in the text input using the following codes:

```<code><script>
    $(function() {
        $("#occupation").autocomplete({
            source: 'search.php',
            delay: 500,
            select: function(event, ui) {
                $(this).val(ui.item.value)
            }
        });
    });
</script>
<input type='text' name='occupation' id='occupation’>
</code>```

The search.php code:

```<code><?php
$searchTerm = $_GET['term'];
$query = $db->query("SELECT DISTINCT occupation FROM table WHERE occupation LIKE '%" . $searchTerm . "%' ORDER BY occupation ASC");
$a_json = array();

while ($row = $query->fetch_assoc())
    {
    $data_row["value"] = $row['occupation'] . ' for';
    $data_row["label"] = $row['occupation'];
    array_push($a_json, $data_row);
    }

echo json_encode($a_json);
</code>```

Now, is there any way to create a second trigger to make an autocomplete for the rest? Like after selecting an occupation, if the user inputs 5, it’ll show the following autocomplete options for the time period: 5 days/ 5 weeks/ 5 months/ 5 years. Like the image below:

Thanks in advance for your suggestions.

答:
I would advise following the Multiple example shown here: http://jqueryui.com/autocomplete/#multiple

Basically, we're going to selectively pick out tags to fill in, using " for" as your delimiter instead of ",".

var occupations = [{
  value: "Assistant for",
  label: "Assistant"
}, {
  value: "Student for",
  label: "Student"
}, {
  value: "Teacher for",
  label: "Teacher"
}];

var oLength = [
  "Days",
  "Weeks",
  "Months",
  "Years"
];

$(function() {
  function split(val) {
    return val.split(/\sfor/);
  }

  function extractLast(term) {
    return split(term).pop();
  }

  $("#occupation").on("keydown", function(event) {
    if (event.keyCode === $.ui.keyCode.TAB &&
      $(this).autocomplete("instance").menu.active) {
      event.preventDefault();
    }
  }).autocomplete({
    minLength: 0,
    source: function(request, response) {
      var term = extractLast(request.term);
      var results = [];
      if (request.term.indexOf("for") > 0) {
        var regE = /^(.*)\sfor\s(\d)\s(.*)$/
        if (regE.test(request.term)) {
          return false;
        }
        if (parseInt(term) > 0) {
          $.each(oLength, function(k, v) {
            results.push(term + " " + v);
          });
        }
      } else {
        results = $.ui.autocomplete.filter(
          occupations, request.term);
      }
      response(results);
    },
    focus: function() {
      // prevent value inserted on focus
      return false;
    },
    select: function(event, ui) {
      var terms = split(this.value);
      terms[0] = terms[0] + " for";
      // remove the current input
      terms.pop();
      // add the selected item
      terms.push(ui.item.value);
      // add placeholder to get the comma-and-space at the end
      terms.push("");
      this.value = terms.join("");
      return false;
    }
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<input type="text" id="occupation" /></code>```

Body:
The sentence structure of my autocomplete is:

<Occupation> <for> <time period>

Example:

Student for 5 years

Teacher for 2 years

In the database, I have a column containing a list of occupations. With jQuery UI autocomplete, I populate the first two sections   in the text input using the following codes:

<input type='text' name='occupation' id='occupation’>

The search.php code:

<?php
$searchTerm = $_GET['term'];
$query = $db->query("SELECT DISTINCT occupation FROM table WHERE occupation LIKE '%" . $searchTerm . "%' ORDER BY occupation ASC");
$a_json = array();

while ($row = $query->fetch_assoc())
    {
    $data_row["value"] = $row['occupation'] . ' for';
    $data_row["label"] = $row['occupation'];
    array_push($a_json, $data_row);
    }

echo json_encode($a_json);

Now, is there any way to create a second trigger to make an autocomplete for the rest? Like after selecting an occupation, if the user inputs 5, it’ll show the following autocomplete options for the time period: 5 days/ 5 weeks/ 5 months/ 5 years. Like the image below:

Thanks in advance for your suggestions.

Body:
I would advise following the Multiple example shown here: http://jqueryui.com/autocomplete/#multiple

Basically, we're going to selectively pick out tags to fill in, using " for" as your delimiter instead of ",".

var occupations = [{
  value: "Assistant for",
  label: "Assistant"
}, {
  value: "Student for",
  label: "Student"
}, {
  value: "Teacher for",
  label: "Teacher"
}];

var oLength = [
  "Days",
  "Weeks",
  "Months",
  "Years"
];

$(function() {
  function split(val) {
    return val.split(/\sfor/);
  }

  function extractLast(term) {
    return split(term).pop();
  }

  $("#occupation").on("keydown", function(event) {
    if (event.keyCode === $.ui.keyCode.TAB &&
      $(this).autocomplete("instance").menu.active) {
      event.preventDefault();
    }
  }).autocomplete({
    minLength: 0,
    source: function(request, response) {
      var term = extractLast(request.term);
      var results = [];
      if (request.term.indexOf("for") > 0) {
        var regE = /^(.*)\sfor\s(\d)\s(.*)$/
        if (regE.test(request.term)) {
          return false;
        }
        if (parseInt(term) > 0) {
          $.each(oLength, function(k, v) {
            results.push(term + " " + v);
          });
        }
      } else {
        results = $.ui.autocomplete.filter(
          occupations, request.term);
      }
      response(results);
    },
    focus: function() {
      // prevent value inserted on focus
      return false;
    },
    select: function(event, ui) {
      var terms = split(this.value);
      terms[0] = terms[0] + " for";
      // remove the current input
      terms.pop();
      // add the selected item
      terms.push(ui.item.value);
      // add placeholder to get the comma-and-space at the end
      terms.push("");
      this.value = terms.join("");
      return false;
    }
  });
});

<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<input type="text" id="occupation" />


问:
remove value from string
If I have a string with IDs

```<code>$myIDs = '22,34,445,67889,23';
</code>```

and I am given a value, how do I remove it from the string, assuming I know for sure it is in the string?

```<code>$removeID = '445';
</code>```

Do I user preg_replace or is there a better method? For example, if it is in the middle of the string and I remove just a value, I'll end up with two commas and then I need to replace those with a single comma?

```<code>preg_replace($removeID, '', $myIDs);
</code>```

UPDATE: These are all great suggestions. However, I just thought about one potential issue. This probably need to be handled as an array instead of regex. What is my string looks like this

```<code>$myIDs = '2312,23,234234';
</code>```

and ID to remove

```<code>$removeID = '23';
</code>```

There's too many potential matches...

答:
You could use a regex:

```<code>$remove = preg_quote($removeID, '/');
$regex = '/,'.$remove.'$|^'.$remove.',|^'.$remove.'$|,'.$remove.'(?=,)/';
$myIDs = preg_replace($regex, '', $myIDs);
</code>```

Which basically says:  replace $removeID where it's prefixed by either the start of the string, or a comma and suffixed by either the end of the string or another comma.

Edit: I've changed the regex to a tested regex (I've tested all the possibilities, and it appears to work in all cases I can think of)...

ContentLicense: CC BY-SA 2.5

Title: remove value from string

Body:
If I have a string with IDs

$myIDs = '22,34,445,67889,23';

and I am given a value, how do I remove it from the string, assuming I know for sure it is in the string?

$removeID = '445';

Do I user preg_replace or is there a better method? For example, if it is in the middle of the string and I remove just a value, I'll end up with two commas and then I need to replace those with a single comma?

preg_replace($removeID, '', $myIDs);

UPDATE: These are all great suggestions. However, I just thought about one potential issue. This probably need to be handled as an array instead of regex. What is my string looks like this

$myIDs = '2312,23,234234';

and ID to remove

$removeID = '23';

There's too many potential matches...

Body:
You could use a regex:

$remove = preg_quote($removeID, '/');
$regex = '/,'.$remove.'$|^'.$remove.',|^'.$remove.'$|,'.$remove.'(?=,)/';
$myIDs = preg_replace($regex, '', $myIDs);

Which basically says:  replace $removeID where it's prefixed by either the start of the string, or a comma and suffixed by either the end of the string or another comma.

Edit: I've changed the regex to a tested regex (I've tested all the possibilities, and it appears to work in all cases I can think of)...


问:
using cocoapods in existing iOS project
In our iOS project, we are using lots of libraries, but using then as static libraries (.a and .h). But many of the new libraries provides cocoapods interface. How can we keep all the static libraries and use cocoapods for new libraies which we are planning to integrate. Or do we need to do cocoapods for all libraries used in our project. Please advice.</p>

答:
Adding CocoaPods to an existing project will not affect any existing use of libraries in the project. I added CocoaPods to one of my projects after years of only using static libraries and other frameworks.

The only adjustment you will need to make is when replacing a specific static library with a CocoaPod version. But that's fairly simple and is handled for each specific case.

Title: using cocoapods in existing iOS project


问:
Custom hover effects for each point in plotly boxplot with markers in R
The following link - https://plot.ly/r/box-plots/#basic-boxplot - leads to the main tutorial that plotly offers for boxplots in R, and the specific plot type that I am interested in working with is the following:

```<code>p <- plot_ly(y = ~rnorm(50), type = "box", boxpoints = "all", jitter = 0.3,
        pointpos = -1.8)
</code>```

In particular, I would like to play around with the hovertext on these plots, so that I am able to hover over each point individually. For anybody familiar with plotly, is this possible with the boxplot type in plotly R, or would I be forced to use the scatter type?

My plot is going to have ~10-12 different boxplots on it, which would make doing this plot with scatter plots quite difficult. In particular, I like how easy it is to add additional boxplots to this plot, and how the colors update automatically when new plots are added.

In particular, here's a rough example (albeit with fewer boxplots) of what I'm trying to make:

答:
I believe you want to change the hovermode under the layout option to closest.</p>

```<code>p <- plot_ly(y = ~rnorm(50), type = "box", boxpoints = "all", jitter = 0.3,
    pointpos = -1.8) %>% layout(hovermode = "closest")
</code>```

Body:
The following link - https://plot.ly/r/box-plots/#basic-boxplot - leads to the main tutorial that plotly offers for boxplots in R, and the specific plot type that I am interested in working with is the following:

p <- plot_ly(y = ~rnorm(50), type = "box", boxpoints = "all", jitter = 0.3,
        pointpos = -1.8)

In particular, I would like to play around with the hovertext on these plots, so that I am able to hover over each point individually. For anybody familiar with plotly, is this possible with the boxplot type in plotly R, or would I be forced to use the scatter type?

My plot is going to have ~10-12 different boxplots on it, which would make doing this plot with scatter plots quite difficult. In particular, I like how easy it is to add additional boxplots to this plot, and how the colors update automatically when new plots are added.

In particular, here's a rough example (albeit with fewer boxplots) of what I'm trying to make:

Body:
I believe you want to change the hovermode under the layout option to closest.

p <- plot_ly(y = ~rnorm(50), type = "box", boxpoints = "all", jitter = 0.3,
    pointpos = -1.8) %>% layout(hovermode = "closest")