• 飞

    P119T,TestControllerIntegrationTests无法通过Junit,报404,不是预期的200. 但可以成功部署highlight_spring4到Tomcat(需要注析TestControllerIntegrationTests),请问这个是什么原因 ?

    飞发表于 2018/4/27 0:18:25
  • 焱成

    本书3.7测试(第67页),
    spring-test的version ${spring-framework.version}即前面文章的4.1.6RELEASE,
    junit的version为4.11,
    我测试时无法通过,后来把${spring-framework.version} 全部换成4.3.76RELEASE,
    junit的version换成4.12,测试才通过.
    这个坑,我先帮忙填上了.

    焱成发表于 2018/3/19 23:38:24
  • 小悠丶

    汪老师您好,书中147页注解 @ConfigurationProperties 中是没有 locations 这个属性的

    小悠丶发表于 2018/3/6 16:15:44
    • 小悠丶

      String[] locations() default {};
      经看源码 1.3.0是有的
      我用的1.5所以没有

      小悠丶发表于 2018/3/6 16:31:14
    • 小悠丶

      据官方解释是1.4以后放弃这个location属性,是为了鼓励大家多用Environment
      大概就是
      新建一个类,监听ApplicationEnvironmentPreparedEvent事件,通过ResourceLoader加载自定义的配置文件

      小悠丶发表于 2018/3/6 16:39:46
    • 小悠丶

      @小悠丶附上链接
      https://github.com/spring-projects/spring-boot/issues/6220#issuecomment-228412077


      同样属性,如果application.properties里面有会覆盖自定义的文件属性

      小悠丶发表于 2018/3/6 17:25:39
  • wysxwdm

    com.wisely.highlight_spring4.ch3.aware.AwareConfig中的@ComponentScan(“com.wisely.highlight_spring4.ch2.aware”)有错误,应该是@ComponentScan(“com.wisely.highlight_spring4.ch3.aware”)

    wysxwdm发表于 2018/2/6 14:58:16
  • mi刷刷刷

    ch8_6_2的源码,部署运行后报错,Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘personDao’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘stringRedisTemplate’ **ailable,老师帮看看什么原因?

    mi刷刷刷发表于 2018/1/17 19:05:19
    • mi刷刷刷

      盼望答复,好像没有自动配置bean,困扰了半天了,谢谢!!!

      mi刷刷刷发表于 2018/1/17 19:08:52
  • 1
  • ...
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • ...
  • 14