4 • Spring Data Jpa • Spring Web Mvc • Mockito • Jackson • Bean Override • UriComponentsBuilder • spring-boot-properties-migrator • (Spring Boot Actuator)
30 $ mvn test [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ demo --- … java.lang.IllegalStateException: Failed to load ApplicationContext … Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'mappedInterceptor' defined in com.kawakawaryuryu.boot15.demo.config.AppTestConfig: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=appTestConfig; factoryMethodName=mappedInterceptor; initMethodName=null; destroyMethodName=(inferred); defined in com.kawakawaryuryu.boot15.demo.config.AppTestConfig] for bean 'mappedInterceptor': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=appConfig; factoryMethodName=mappedInterceptor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/kawakawaryuryu/boot15/demo/config/AppConfig.class]] bound.
31 $ mvn test [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ demo --- … java.lang.IllegalStateException: Failed to load ApplicationContext … Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'mappedInterceptor' defined in com.kawakawaryuryu.boot15.demo.config.AppTestConfig: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=appTestConfig; factoryMethodName=mappedInterceptor; initMethodName=null; destroyMethodName=(inferred); defined in com.kawakawaryuryu.boot15.demo.config.AppTestConfig] for bean 'mappedInterceptor': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=appConfig; factoryMethodName=mappedInterceptor; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/kawakawaryuryu/boot15/demo/config/AppConfig.class]] bound.
32 @Configuration public class AppConfig { @Bean public MappedInterceptor mappedInterceptor() { return new MappedInterceptor(new String[]{"/sample"}, new SampleInterceptor()); } } @TestConfiguration public class AppTestConfig { @Bean public MappedInterceptor mappedInterceptor() { return new MappedInterceptor(new String[]{"/**"}, new String[]{"/**"}, new SampleInterceptor()); } } Beanを Overrideして 書き換えている
34 $ mvn test [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ demo --- … [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.532 s <<< FAILURE! - in com.kawakawaryuryu.boot15.demo.service.SampleServiceTest [ERROR] testSampleString(com.kawakawaryuryu.boot15.demo.service.SampleServiceTest) Time elapsed: 0.016 s <<< FAILURE! org.mockito.exceptions.verification.junit.ArgumentsAreDifferent: Argument(s) are different! Wanted: dependencyService.callString(<any string>); -> at com.kawakawaryuryu.boot15.demo.service.SampleServiceTest.testSampleString(SampleServiceTest.java:45) Actual invocation has different arguments: dependencyService.callString(null); -> at com.kawakawaryuryu.boot15.demo.service.SampleService.sampleString(SampleService.java:26) at com.kawakawaryuryu.boot15.demo.service.SampleServiceTest.testSampleString(SampleServiceTest.java:45)
35 $ mvn test [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ demo --- … [ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.532 s <<< FAILURE! - in com.kawakawaryuryu.boot15.demo.service.SampleServiceTest [ERROR] testSampleString(com.kawakawaryuryu.boot15.demo.service.SampleServiceTest) Time elapsed: 0.016 s <<< FAILURE! org.mockito.exceptions.verification.junit.ArgumentsAreDifferent: Argument(s) are different! Wanted: dependencyService.callString(<any string>); -> at com.kawakawaryuryu.boot15.demo.service.SampleServiceTest.testSampleString(SampleServiceTest.java:45) Actual invocation has different arguments: dependencyService.callString(null); -> at com.kawakawaryuryu.boot15.demo.service.SampleService.sampleString(SampleService.java:26) at com.kawakawaryuryu.boot15.demo.service.SampleServiceTest.testSampleString(SampleServiceTest.java:45)
38 • クエリパラメータが エンコードされなくなったエラー [ERROR] testGetSample(com.kawakawaryuryu.boot15.demo.client.SampleClientTest) Time elapsed: 0.025 s <<< FAILURE! java.lang.AssertionError: Request URI expected:</sample?q=%2Bhoge> but was:</sample?q=+hoge> at com.kawakawaryuryu.boot15.demo.client.SampleClientTest.testGetSample(SampleClientTest.java:28)
Spring Boot Actuator 43 2020-02-05 01:13:58.997 WARN 67638 --- [ main] o.s.b.c.p.m.PropertiesMigrationListener : The use of configuration keys that have been renamed was found in the environment: Property source 'applicationConfig: [classpath:/application.yml]': Key: endpoints.enabled Line: 2 Replacement: management.endpoints.enabled-by-default Key: endpoints.health.enabled Line: 4 Replacement: management.endpoint.health.enabled Each configuration key has been temporarily mapped to its replacement for your convenience. To silence this warning, please update your configuration to use the new keys. endpoints: enabled: false health: enabled: true management: endpoints: enabled-by-default: false endpoint: health: enabled: true Boot 1.5 Boot 2.0
52 • H2 Database Engine • trace.db/h2datasource.trace.db 2020-01-16 00:09:52 JDBCX: exception org.h2.jdbc.JdbcSQLException: 機能はサポートされていません: "isWrapperFor" Feature not supported: "isWrapperFor" [50100-192] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:179) at org.h2.message.DbException.get(DbException.java:155) at org.h2.message.DbException.getUnsupportedException(DbException.java:216) at org.h2.message.TraceObject.unsupported(TraceObject.java:375) at org.h2.jdbcx.JdbcDataSource.isWrapperFor(JdbcDataSource.java:422) at org.springframework.boot.jdbc.DataSourceUnwrapper.safeUnwrap(DataSourceUnwrapper.java:77) …