首页 文章 精选 留言 我的

精选列表

搜索[CI更新],共10000篇文章
优秀的个人博客,低调大师

Spring Boot 1.4.0 Release Notes 更新日志-01

Spring Boot 1.4.0 Release Notes Upgrading from Spring Boot 1.3 Deprecations from Spring Boot 1.3 Classes, methods and properties that were deprecated in Spring Boot 1.3 have been removed in this release. Please ensure that you aren’t calling deprecated methods before upgrading. Log4j 1 support has been removed followingApache EOL announcement. Renamed starters The following starters have been renamed, the old ones will be removed in Spring Boot 2.0 spring-boot-starter-ws→spring-boot-starter-web-services spring-boot-starter-redis→spring-boot-starter-data-redis DataSourceProperties get methods Someget…methods fromDataSourcePropertieshave been changed to be more consistent with other@ConfigurationPropertiesclasses. If you previously directly called any of the following methods in your code, you will need to migrate to the newdetermine…()equivalents: getDriverClassName()→determineDriverClassName() getUrl()→determineUrl() getUsername()→determineUsername() getPassword()→determineUsername() Note Thegetmethods are not deprecated but their behavior has changed, make sure that you manually check for usage when upgrading. DataSource binding Prior to Spring Boot 1.4, auto-configured datasources were bound to thespring.datasourcenamespace. In 1.4, we only bind the common settings tospring.datasource(seeDataSourceProperties) and we have defined newspecificnamespaces for the four connections pools we support (in that order): spring.datasource.tomcatfororg.apache.tomcat.jdbc.pool.DataSource spring.datasource.hikariforcom.zaxxer.hikari.HikariDataSource spring.datasource.dbcpfororg.apache.commons.dbcp.BasicDataSource spring.datasource.dbcp2fororg.apache.commons.dbcp2.BasicDataSource If you were using specific settings of the connection pool implementation that you are using, you will have to move that configuration to the relevant namespace. For instance, if you were using Tomcat’stestOnBorrowflag, you’ll have to move it fromspring.datasource.test-on-borrowtospring.datasource.tomcat.test-on-borrow. If you are using configuration assistance in your IDE, you can now see which settings are available per connection pools rather than having all of them mixed in thespring.datasourcenamespace. This should make your life much easier figuring out what implementation supports what features. JTA settings binding Similarly toDataSource binding, JTA provider-specific configuration properties for Atomikos and Bitronix were bound tospring.jta. They are now bound tospring.jta.atomikos.propertiesandspring.jta.bitronix.propertiesrespectively; the meta-data for these entries has been greatly improved as well. Hibernate 5 Hibernate 5.0 is now used as the default JPA persistence provider. If you are upgrading from Spring Boot 1.3 you will be moving from Hibernate 4.3 to Hibernate 5.0. Please refer toHibernate migration documentationfor general upgrade instructions. In addition you should be aware of the following: Naming Strategy SpringNamingStrategyis no longer used as Hibernate 5.1 has removed support for the oldNamingStrategyinterface. A newSpringPhysicalNamingStrategyis now auto-configured which is used in combination with Hibernate’s defaultImplicitNamingStrategy. This should be very close to (if not identical) to Spring Boot 1.3 defaults, however, you should check your Database schema is correct when upgrading. If you were already using Hibernate 5 before upgrading, you may be using Hibernate’s 5 default. If you want to restore them after the upgrade, set this property in your configuration: spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl Generator mappings In order to minimize upgrade pain, we sethibernate.id.new_generator_mappingstofalsefor Hibernate 5. The Hibernate team generally don’t recommend this setting, so if you’re happy to deal with generator changes, you might want to setspring.jpa.hibernate.use-new-id-generator-mappingstotruein yourapplication.propertiesfile. Downgrading to Hibernate 4.3 If you have major problems upgrading to Hibernate 5.0 you can downgrade to the older Hibernate version by overriding thehibernate.versionproperty in yourpom.xml: 4.3.11.Final Or overriding thehibernate.versionproperty in your Gradle script: ext['hibernate.version']='4.3.11.Final' Note Hibernate 4.3 will not be supported past Spring Boot 1.4. Pleaseraise an issueif you find a bug that prevents you from upgrading. @EntityScan The@org.springframework.boot.orm.jpa.EntityScanannotation has been deprecated and should be replaced with@org.springframework.boot.autoconfigure.domain.EntityScanor explicit configuration. For example, if you have following configuration: importorg.springframework.boot.autoconfigure.SpringApplication; importorg.springframework.boot.orm.jpa.EntityScan; @SpringBootApplication @EntityScan(basePackageClasses=Customer.class) publicclassMyApplication{ //.... } If you’re using an auto-configuredLocalContainerEntityManagerFactoryBean, switch to: importorg.springframework.boot.autoconfigure.SpringApplication; importorg.springframework.boot.autoconfigure.domain.EntityScan; @SpringBootApplication @EntityScan(basePackageClasses=Customer.class) publicclassMyApplication{ //.... } Or if you’re defining your ownLocalContainerEntityManagerFactoryBeandrop the@EntityScanannotation entirely and either callLocalContainerEntityManagerFactoryBean.setPackagesToScan(…)or make use of theEntityManagerFactoryBuilderpackages(…)method: @Bean publicLocalContainerEntityManagerFactoryBeanentityManagerFactory( EntityManagerFactoryBuilderbuilder){ returnbuilder .dataSource(...) .properties(...) .packages(Customer.class) .build(); } Test utilities and classes Spring Boot 1.4 ships with a newspring-boot-testmodule that contains a completely reorganizedorg.springframework.boot.testpackage. When upgrading a Spring Boot 1.3 application you should migrate from the deprecated classes in the old package to the equivalent class in the new structure. If you’re using Linux or OSX, you can use the following command to migrate code: find.-typef-name'*.java'-execsed-i''\ -es/org.springframework.boot.test.ConfigFileApplicationContextInitializer/org.springframework.boot.test.context.ConfigFileApplicationContextInitializer/g\ -es/org.springframework.boot.test.EnvironmentTestUtils/org.springframework.boot.test.util.EnvironmentTestUtils/g\ -es/org.springframework.boot.test.OutputCapture/org.springframework.boot.test.rule.OutputCapture/g\ -es/org.springframework.boot.test.SpringApplicationContextLoader/org.springframework.boot.test.context.SpringApplicationContextLoader/g\ -es/org.springframework.boot.test.SpringBootMockServletContext/org.springframework.boot.test.mock.web.SpringBootMockServletContext/g\ -es/org.springframework.boot.test.TestRestTemplate/org.springframework.boot.test.web.client.TestRestTemplate/g\ {}\; Additionally, Spring Boot 1.4 attempts to rationalize and simplify the various ways that a Spring Boot test can be run. You should migrate the following to use the new@SpringBootTestannotation: From@SpringApplicationConfiguration(classes=MyConfig.class)to@SpringBootTest(classes=MyConfig.class) From@ContextConfiguration(classes=MyConfig.class, loader=SpringApplicationContextLoader.class)to@SpringBootTest(classes=MyConfig.class) From@ContextConfiguration(classes=MyConfig.class, loader=SpringApplicationContextLoader.class)to@SpringBootTest(classes=MyConfig.class) From@IntegrationTestto@SpringBootTest(webEnvironment=WebEnvironment.NONE) From@IntegrationTest with @WebAppConfigurationto@SpringBootTest(webEnvironment=WebEnvironment.DEFINED_PORT)(orRANDOM_PORT) From@WebIntegrationTestto@SpringBootTest(webEnvironment=WebEnvironment.DEFINED_PORT)(orRANDOM_PORT) Tip Whilst migrating tests you may also want to replace any@RunWith(SpringJUnit4ClassRunner.class)declarations with Spring 4.3’s more readable@RunWith(SpringRunner.class). For more details on the@SpringBootTestannotation refer to theupdated documentation. TestRestTemplate TheTestRestTemplateclass no longer directly extendsRestTemplate(although it continues to offer the same methods). This allowsTestRestTemplateto be configured as a bean without it being accidentally injected. If you need access to the actual underlyingRestTemplateuse thegetRestTemplate()method. Maven spring-boot.version property Thespring-boot.versionproperty has been removed from thespring-boot-dependenciespom. Seeissue 5104for details. Integration Starter spring-boot-starter-integrationhas been streamlined by removing four modules that are not necessarily used by a typical Spring Integration application. The four modules removed were: spring-integration-file spring-integration-http spring-integration-ip spring-integration-stream If your application relies on any of these four modules, you should add an explicit dependency to your pom or build.gradle. Additionally,spring-integration-java-dslandspring-integration-jmxhave now been added to the starter. Using the DSL is the recommended way to configure Spring Integration in your application. Spring Batch Starter Thespring-boot-starter-batchstarter no longer depends on an embedded database. If you were relying on this arrangement, please add a database (driver) of your choice, e.g. org.springframework.bootspring-boot-starter-batchorg.hsqldbhsqldbruntime If you had an exclusion onhsqldbas you were already configuring your own, you can now remove the exclusion. Downgrading Tomcat As of Tomcat 8.5.4 thetomcat-julimodule is now packaged as part oftomcat-embedded. Most users won’t notice this change, however, if you manually downgrade to an older version of Tomcat you’ll now need to add thetomcat-julimodule yourself. See thehow-to documentation sectionfor updated instructions. Dispatch Options Request The defaultspring.mvc.dispatch-options-requestproperty has changed fromfalsetotrueto align with Spring Framework’s preferred default. If you don’t wantOPTIONSrequests to be dispatched toFrameworkServlet.doServiceyou should explicitly setspring.mvc.dispatch-options-requesttofalse. Forced character encoding Forced character encoding now only applies to requests (and not responses). If you want to force encoding for both requests and responses setspring.http.encoding.forcetotrue. Multipart support The multipart properties have moved from themultipart.namespace to thespring.http.multipart.namespace. Server header TheServerHTTP response header is no longer set unless theserver.server-headerproperty is set. @ConfigurationProperties default bean names When a@ConfigurationPropertiesbean is registered via@EnableConfigurationProperties(SomeBean.class), we used to generate a bean name of the form. As of Spring Boot 1.4, we have changed that pattern to avoid name clashes if two beans use the same prefix. The new conventional name is, whereis the environment key prefix specified in the@ConfigurationPropertiesannotation and Jetty JNDI support Thespring-boot-starter-jetty"Starter" no longer includesorg.eclipse.jetty:jetty-jndi. If you are using Jetty with JNDI you will now need to directly add this dependency yourself. Guava caches Developers using Guava cache support are advised to migrate toCaffeine. Remote Shell TheCRaSHproperties have moved from theshell.namespace to themanagement.shell.namespace. Also, the authentication type should now be defined viamanagement.shell.auth.type. Spring Session auto-configuration improvements Spring Boot supports more backend stores for Spring Session: alongside Redis, JDBC, MongoDB, Hazelcast and in memory concurrent hash maps are also supported. A newspring.session.store-typemandatory property has been introduced to select the store Spring Session should be using. Launch script identity When the launch script is determining the application’s default identity, the canonical name of the directory containing the jar will now be used. Previously, if the directory containing the jar was a symlink, the name of the symlink was used. If you require more control over the application’s identity, theAPP_NAMEenvironment variable should be used. MongoDB 3 The default version of Mongo’s Java Driver is now 3.2.2 (from 2.14.2) andspring-boot-starter-data-mongodbhas been updated to use the new, preferredmongodb-driverartifact. The auto-configuration for Embedded MongoDB has also been updated to use 3.2.2 as its default version. Thymeleaf 3 By default, Spring Boot uses Thymeleaf 2.1 but it is now compatible with Thymeleaf 3 as well, check theupdated documentationfor more details. Executable jar layout The layout of executable jars has changed. If you are using Spring Boot’s Maven, Gradle, or Ant support to build your application this change will not affect you. If you are building an executable archive yourself, please be aware that an application’s dependencies are now packaged inBOOT-INF/librather thanlib, and an application’s own classes are now packaged inBOOT-INF/classesrather than the root of the jar. HornetQ Support for HornetQ has been deprecated. Users of HornetQ should consider migrating to Artemis. New and Noteworthy Tip Checkthe configuration changelogfor a complete overview of the changes in configuration.

优秀的个人博客,低调大师

Spring Boot 1.4.0 Release Notes 更新日志-02

Spring Framework 4.3 Spring Boot 1.4 builds on and requires Spring Framework 4.3. There are a number of nice refinements in Spring Framework 4.3 including new Spring MVC@RequestMappingannotations. Refer to theSpring Framework reference documentationfor details. Note that the test framework in Spring Framework 4.3 requires JUnit 4.12. SeeSPR-13275for further details. Third-party library upgrades A number of third party libraries have been upgraded to their latest version. Updates include Jetty 9.3, Tomcat 8.5, Jersey 2.23, Hibernate 5.0, Jackson 2.7, Solr 5.5, Spring Data Hopper, Spring Session 1.2, Hazelcast 3.6, Artemis 1.3, Ehcache 3.1, Elasticsearch 2.3, Spring REST Docs 1.1, Spring AMQP 1.6 & Spring Integration 4.3. Several Maven plugins were also upgraded. Couchbase support Full auto-configuration support is now provided for Couchbase. You can easily access aBucketandClusterbean by adding thespring-boot-starter-data-couchbase"Starter" and providing a little configuration: spring.couchbase.bootstrap-hosts=my-host-1,192.168.1.123 spring.couchbase.bucket.name=my-bucket spring.couchbase.bucket.password=secret It’s also possible to use Couchbase as a backing store for a Spring DataRepositoryor as aCacheManager. Refer to theupdated documentationfor details. Neo4J Support Auto-configuration support is now provided for Neo4J. You can connect to a remote server or run an embedded Neo4J server. You can also use Neo4J to back a Spring DataRepository, for example: publicinterfaceCityRepositoryextendsGraphRepository{PagefindAll(Pageablepageable);CityfindByNameAndCountry(Stringname,Stringcountry); } Full details are provided in theNeo4J sectionof the reference documentation. Redis Spring Data repositories Redis can now be used to back Spring Data repositories. See theSpring Data Redisdocumentation for more details. Narayana transaction manager support Auto-configuration support is now included for the Narayana transaction manager. You can choose between Narayana, Bitronix or Atomkos if you need JTA support. Seethe updated reference guidefor details. Caffeine cache support Auto-configuration is provided for Caffeine v2.2 (a Java 8 rewrite of Guava’s caching support). Existing Guava cache users should consider migrating to Caffeine as Guava cache support will be dropped in a future release. Elasticsearch Jest support Spring Boot auto-configures aJestClientand a dedicatedHealthIndicatorif Jest is on the classpath. This allows you to useElasticsearcheven whenspring-data-elasticsearchisn’t on the classpath. Analysis of startup failures Spring Boot will now perform analysis of common startup failures and provide useful diagnostic information rather than simply logging an exception and its stack trace. For example, a startup failure due to the embedded servlet container’s port being in use looked like this in earlier versions of Spring Boot: 2016-02-1617:46:14.334ERROR24753---[main]o.s.boot.SpringApplication:Applicationstartupfailed java.lang.RuntimeException:java.net.BindException:Addressalreadyinuse atio.undertow.Undertow.start(Undertow.java:181)~[undertow-core-1.3.14.Final.jar:1.3.14.Final] atorg.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainer.start(UndertowEmbeddedServletContainer.java:121)~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] atorg.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:293)~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] atorg.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:141)~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] atorg.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] atorg.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] atorg.springframework.boot.SpringApplication.run(SpringApplication.java:307)[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1191)[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1180)[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE] atsample.undertow.SampleUndertowApplication.main(SampleUndertowApplication.java:26)[classes/:na] Causedby:java.net.BindException:Addressalreadyinuse atsun.nio.ch.Net.bind0(NativeMethod)~[na:1.8.0_60] atsun.nio.ch.Net.bind(Net.java:433)~[na:1.8.0_60] atsun.nio.ch.Net.bind(Net.java:425)~[na:1.8.0_60] atsun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)~[na:1.8.0_60] atsun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)~[na:1.8.0_60] atorg.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:190)~[xnio-nio-3.3.4.Final.jar:3.3.4.Final] atorg.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:243)~[xnio-api-3.3.4.Final.jar:3.3.4.Final] atio.undertow.Undertow.start(Undertow.java:137)~[undertow-core-1.3.14.Final.jar:1.3.14.Final] ...11commonframesomitted In 1.4, it will look like this: 2016-02-1617:44:49.179ERROR24745---[main]o.s.b.d.LoggingFailureAnalysisReporter: *************************** APPLICATIONFAILEDTOSTART *************************** Description: Embeddedservletcontainerfailedtostart.Port8080wasalreadyinuse. Action: Identifyandstoptheprocessthat'slisteningonport8080orconfigurethisapplicationtolistenonanotherport. If you still want to see the stacktrace of the underlying cause, enable debug logging fororg.springframework.boot.diagnostics.LoggingFailureAnalysisReporter. Image Banners You can now use image files to render ASCII art banners. Drop abanner.gif,banner.jpgorbanner.pngfile intosrc/main/resourcesto have it automatically converted to ASCII. You can use thebanner.image.widthandbanner.image.heightproperties to tweak the size, or usebanner.image.invertto invert the colors. RestTemplate builder A newRestTemplateBuildercan be used to easily create aRestTemplatewith sensible defaults. By default, the builtRestTemplatewill attempt to use the most suitableClientHttpRequestFactoryavailable on the classpath and will be aware of theMessageConverterinstances to use (including Jackson). The builder includes a number of useful methods that can be used to quickly configure aRestTemplate. For example, to add BASIC auth support you can use: @BeanpublicRestTemplaterestTemplate(RestTemplateBuilderbuilder){returnbuilder.basicAuthorization("user","secret").build(); } The auto-configuredTestRestTemplatenow uses theRestTemplateBuilderas well. JSON Components A new@JsonComponentannotation is now provided for custom JacksonJsonSerializerand/orJsonDeserializerregistration. This can be a useful way to decouple JSON serialization logic: @JsonComponentpublicclassExample{publicstaticclassSerializerextendsJsonSerializer{//... }publicstaticclassDeserializerextendsJsonDeserializer{//... } } Additionally, Spring Boot also now providesJsonObjectSerializerandJsonObjectDeserializerbase classes which provide useful alternatives to the standard Jackson versions when serializing objects. See theupdated documentationfor details. Convention based error pages Custom error pages for a given status code can now be created by following a convention based approach. Create a static HTML file in/public/erroror add a template to/templates/errorusing the status code as the filename. For example, to register a custom 404 file you could addsrc/main/resource/public/error/404.html. Seethe updated reference documentationfor details. Unified@EntityScanannotation org.springframework.boot.autoconfigure.domain.EntityScancan now be used to specify the packages to use for JPA, Neo4J, MongoDB, Cassandra and Couchbase. As a result, the JPA-specificorg.springframework.boot.orm.jpa.EntityScanis now deprecated. ErrorPageRegistry NewErrorPageRegistryandErrorPageRegistrarinterfaces allow error pages to be registered in a consistent way regardless of the use of an embedded servlet container. TheErrorPageFilterclass has been updated to that it is now aErrorPageRegistryand not a fakeConfigurableEmbeddedServletContainer. PrincipalExtractor ThePrincipalExtractorinterface can now be used if you need to extract the OAuth2Principalusing custom logic. Test improvements Spring Boot 1.4 includes a major overhaul of testing support. Test classes and utilities are now provided in dedicatedspring-boot-testandspring-boot-test-autoconfigurejars (although most users will continue to pick them up via thespring-boot-starter-test"Starter"). We’ve added AssertJ, JSONassert and JsonPath dependencies to the test starter. @SpringBootTest With Spring Boot 1.3 there were multiple ways of writing a Spring Boot test. You could use@SpringApplicationConfiguration,@ContextConfigurationwith theSpringApplicationContextLoader,@IntegrationTestor@WebIntegrationTest. With Spring Boot 1.4, a single@SpringBootTestannotation replaces all of those. Use@SpringBootTestin combination with@RunWith(SpringRunner.class)and set thewebEnvironmentattribute depending on the type of test you want to write. A classic integration test, with a mocked servlet environment: @RunWith(SpringRunner.class) @SpringBootTestpublicclassMyTest{//...} A web integration test, running a live server listening on a defined port: @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment=WebEnvionment.DEFINED_PORT)publicclassMyTest{//...} A web integration test, running a live server listening on a random port: @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment=WebEnvionment.RANDOM_PORT)publicclassMyTest{ @LocalServerPort privateintactualPort; //...} See theupdated reference documentationfor details. Auto-detection of test configuration Test configuration can now be automatically detected for most tests. If you follow the Spring Boot recommended conventions for structuring your code the@SpringBootApplicationclass will be loaded when no explicit configuration is defined. If you need to load a different@Configurationclass you can either include it as a nested inner-class in your test, or use theclassesattribute of@SpringBootTest. SeeDetecting test configurationfor details. Mocking and spying beans It’s quite common to want to replace a single bean in yourApplicationContextwith a mock for testing purposes. With Spring Boot 1.4 this now as easy as annotating a field in your test with@MockBean: @RunWith(SpringRunner.class) @SpringBootTestpublicclassMyTest{@MockBean privateRemoteServiceremoteService;@Autowired privateReverserreverser;@Test publicvoidexampleTest(){//RemoteServicehasbeeninjectedintothereverserbean given(this.remoteService.someCall()).willReturn("mock");Stringreverse=reverser.reverseSomeCall(); assertThat(reverse).isEqualTo("kcom"); } } You can also use@SpyBeanif you want to spy on an existing bean rather than using a full mock. See themocking sectionof the reference documentation for more details. Auto-configured tests Full application auto-configuration is sometime overkill for tests, you often only want to auto-configure a specific "slice" of your application. Spring Boot 1.4 introduces a number of specialized test annotations that can be used for testing specific parts of your application: @JsonTest- For testing JSON marshalling and unmarshalling. @WebMvcTest- For testing Spring MVC@Controllersusing MockMVC. @RestClientTest- For testing RestTemplate calls. @DataJpaTest- For testing Spring Data JPA elements Many of the annotations provide additional auto-configuration that’s specific to testing. For example, if you use@WebMvcTestyou can@Autowirea fully configuredMockMvcinstance. See thereference documentationfor details. JSON AssertJ assertions NewJacksonTester,GsonTesterandBasicJsonTesterclasses can be used in combination with AssertJ to test JSON marshalling and unmarshalling. Testers can be used with the@JsonTestannotation or directly on a test class: @RunWith(SpringRunner.class) @JsonTestpublicclassMyJsonTests{privateJacksonTesterjson;@Test publicvoidtestSerialize()throwsException{VehicleDetailsdetails=newVehicleDetails("Honda","Civic"); assertThat(this.json.write(details)).isEqualToJson("expected.json"); assertThat(this.json.write(details)).hasJsonPathStringValue("@.make"); } } See theJSON sectionof the reference documentation or the Javadocs for details. @RestClientTest The@RestClientTestannotation can be used if you want to test REST clients. By default it will auto-configure Jackson and GSON support, configure aRestTemplateBuilderand add support forMockRestServiceServer. Auto-configuration for Spring REST Docs Combined with the support for auto-configuringMockMvcdescribed above, auto-configuration for Spring REST Docs has been introduced. REST Docs can be enabled using the new@AutoConfigureRestDocsannotation. This will result in theMockMvcinstance being automatically configured to use REST Docs and also removes the need to use REST Docs' JUnit rule. Please see therelevant sectionof the reference documentation for further details. Test utilities spring-boot-starter-testnow brings theAssertJassertions library. Test utilities from theorg.springframework.boot.testpackage have been moved to aspring-boot-testdedicated artifact. Actuator info endpoint improvements You can now use theInfoContributorinterface to register beans that expose information to the/infoactuator endpoint. Out of the box support is provided for: Full or partial Git information generated from thegit-commit-id-pluginMaven orgradle-git-propertiesGradle plugin (setmanagement.info.git.mode=fullto expose full details) Build information generated from the Spring Boot Maven or Gradle plugin. Custom information from the Environment (any property startinginfo.*) Details are documented in the"Application information"section of the reference docs. MetricsFilter improvements TheMetricsFiltercan now submit metrics in both the classic "merged" form, or grouped per HTTP method. Useendpoints.metrics.filterproperties to change the configuration: endpoints.metrics.filter.gauge-submissions=grouped endpoints.metrics.filter.counter-submissions=grouped,merged Spring Session JDBC Initializer If Spring Session is configured to use the JDBC store, the schema is now created automatically on startup. Secured connection for Artemis/HornetQ Spring Boot now allows to connect against a secured Artemis/HornetQ broker. Miscellaneous server.jetty.acceptorsandserver.jetty.selectorsproperties have been added to configure the number of Jetty acceptors and selectors. server.max-http-header-sizeandserver.max-http-post-sizecan be used to constrain maximum sizes for HTTP headers and HTTP POSTs. Settings work on Tomcat, Jetty and Undertow. The minimum number of spare threads for Tomcat can now be configured usingserver.tomcat.min-spare-threads Profile negation in now supported inapplication.ymlfiles. Use the familiar!prefix inspring.profilesvalues The actuator exposes a newheaddumpendpoint that returns a GZip compressedhprofheap dump file Spring Mobile is now auto-configured for all supported template engines The Spring Boot maven plugin allows to bundlesystemscoped artifacts using the newincludeSystemScopeattribute spring.mvc.log-resolved-exceptionenables the automatic logging of a warning when an exception is resolved by aHandlerExceptionResolver spring.data.cassandra.schema-actionyou be used to customize the schema action to take on startup Spring Boot’s fat jar format should now consume much less memory Locale to Charset mapping is now supported via thespring.http.encoding.mapping.property Spring Data "Ingalls" release train support Spring Boot 1.4 GA ships with the Spring Data "Hopper" release out of the box. Users that would like to try the "Ingalls" release train (available in milestone one at the time of writing) can do so by just setting thespring-data-releasetrain.versionproperty toIngalls-M1and declaring the Spring milestone repository. Depending on what modules of Spring Data you use, you might have to upgrade a couple of transitive dependencies, too: Spring Data REST users will have to upgrade to Spring HATEOAS 0.21 (setspring-hateoas.versionto0.21.0.RELEASE) Spring Data Redis users using Jedis as driver will have to upgrade to 2.9 (setjedis.versionto2.9.0) Deprecations in Spring Boot 1.4 Velocity support has been deprecated since support has been deprecated as of Spring Framework 4.3. Some constructors inUndertowEmbeddedServletContainerhave been deprecated (most uses should be unaffected). Thelocationsandmergeattributes of the@ConfigurationPropertiesannotation have been deprecated in favor of directly configuring theEnvironment. The protectedSpringApplication.printBannermethod should no longer be used to print a custom banner. Use theBannerinterface instead. The protectedInfoEndpoint.getAdditionalInfomethod has been deprecated in favor of theInfoContributorinterface. org.springframework.boot.autoconfigure.test.ImportAutoConfigurationhas been moved toorg.springframework.boot.autoconfigure. All classes in theorg.springframework.boot.testpackage have been deprecated. See the "upgrading" notes above for details. PropertiesConfigurationFactory.setProperties(Properties)is deprecated in favor of usingPropertySources. Several classes in theorg.springframework.boot.context.embeddedpackage have been deprecated and relocated toorg.springframework.boot.web.servlet. All classes in theorg.springframework.boot.context.webpackage have been deprecated and relocated. Thespring-boot-starter-ws"Starter" has been renamed tospring-boot-starter-web-services. Thespring-boot-starter-redis"Starter" has been renamed tospring-boot-starter-data-redis. Thespring-boot-starter-hornetqstarter and auto-configuration has been deprecated in favour of usingspring-boot-starter-artemis management.security.rolehas been deprecated in favour ofmanagement.security.roles The@org.springframework.boot.orm.jpa.EntityScanannotation has been deprecated in favor of@org.springframework.boot.autoconfigure.domain.EntityScanor explicit configuration. TomcatEmbeddedServletContainerFactory.getValves()has been deprecated in favor ofgetContextValves(). org.springframework.boot.actuate.system.EmbeddedServerPortFileWriterhas been deprecated in favor oforg.springframework.boot.system.EmbeddedServerPortFileWriter org.springframework.boot.actuate.system.ApplicationPidFileWriterhas been deprecated in favor oforg.springframework.boot.system.ApplicationPidFileWriter Property Renames spring.jackson.serialization-inclusionshould be replaced withspring.jackson.default-property-inclusion. spring.activemq.pooledshould be replaced withspring.activemq.pool.enabled. spring.jpa.hibernate.naming-strategyshould be replaced withspring.jpa.hibernate.naming.strategy. server.tomcat.max-http-header-sizeshould be replaced withserver.max-http-header-size.

优秀的个人博客,低调大师

Android 开发小知识点收集(随时更新)

1、获取手机运行时最大可占用内存 int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); Log.d("TAG", "Max memory is " + maxMemory + "KB"); 2、改变dialog 在不同窗口内显示不同的大小 //在dialog.show()之后调用 public static void setDialogWindowAttr(Dialog dlg,Context ctx){ Window window = dlg.getWindow(); WindowManager.LayoutParams lp = window.getAttributes(); lp.gravity = Gravity.CENTER; lp.width = LayoutParams.MATH_PARENT;//宽高可设置具体大小 lp.height = LayoutParams.MATH_PARENT; dlg.getWindow().setAttributes(lp); } 摘抄自:简书——MrRock 3、监听Activity是否显示在用户面前 @Override public void onWindowFocusChanged(boolean hasFocus) { // TODO Auto-generated method stub super.onWindowFocusChanged(hasFocus); } 当Activity展示咋用户面前则 hasFocus 为 true; 4、成员变量与局部变量的区别(简写:成、局) 1)、类中位置不同:成:类内 局: 方法内伙子方法上; 2)、内存中位置不同:成:栈内存 局:堆内存; 3)、生命周期不同:成:与对象共存亡 局:与方法共存亡; 4)、初始化值不同:成:有默认值 局:无默认值,必须赋值。 5、Java 获取可变的 uuid uuid 类似于时间戳 永远不可重复。 String uuid = UUID.randomUUID().toString().replaceAll("-", ""); 6、Android 获取 WiFi 的 ssid 1)、在 AndroidManifest.xml 文件内添加权限 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission> 2)、需要获取的位置添加如下代码 WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); Logger.d("wifiInfo"+wifiInfo.toString()); Logger.d("SSID"+wifiInfo.getSSID()); 3)、若不是想获取当前连接,而是想获取WIFI设置中的连接 WifiManager.getConfiguredNetworks() 4)、若获取更多的信息请查看这位兄嘚的博客:Android连续获取当前所连接WiFi及周围热点列表信息的解决方案 . 7、Android 打开 WiFi 设置界面 1)、判断手机是否连接wifi if (ConnectionDetector.getConnectionType(this) != ConnectionDetector.WIFI) { //跳转wifi配置界面 goToWifSetting(); } else { //wifi已经连接 } 代码如下: Intent intent = new Intent(); if(android.os.Build.VERSION.SDK_INT >= 11){ //Honeycomb intent .setClassName("com.android.settings", "com.android.settings.Settings$WifiSettingsActivity"); }else{ //other versions intent .setClassName("com.android.settings", "com.android.settings.wifi.WifiSettings"); } startActivity(intent); 或者 if (android.os.Build.VERSION.SDK_INT > 10) { // 3.0以上打开设置界面,也可以直接用ACTION_WIRELESS_SETTINGS打开到wifi界面 startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS)); } else { startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS)); } 8、Android 8.0 获取 wifi 的 ssid 之前用上面6的方法可以完美的获取wifif设备的 ssid 但是不能显示 ssid 即用户名 ConnectivityManager manager = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); assert manager != null; NetworkInfo info = manager.getActiveNetworkInfo(); if (info != null && info.isConnected()) { String wifiSsid = info.getExtraInfo().substring(1, info.getExtraInfo().length() - 1).trim(); }

优秀的个人博客,低调大师

《阿里巴巴Android开发手册》揭秘|更新下载

一个月前,我们为大家带来了《阿里巴巴 Android 开发手册》,首次公开后,我们收到了业界大量Android开发者的反馈,在广泛听取了各方意见之后,日前已发布迭代版本v1.0.1(下载方式请见文末),这里再次感谢大家的支持和反馈,我们也将不断完善手册内容,为Android开发提效。以下文章来自 InfoQ 对本手册作者之一芸墨的采访报道。 前 言 不久之前谷歌的 Android P 预览版问世,几大手机厂商也联合推出了快应用,我们看到了移动开发迎来了新的活力,移动应用已经渗透到人们生活的方方面面,那么阿里继去年推出 Java 手册之后,在春节期间推出的《阿里巴巴 Android 开发手册》的目的是什么呢?为此,InfoQ 第一时间采访了阿里巴巴高级无线开发工程师、手册的主要作者之一芸墨,为大家揭开其背后创作故事,并在此与大

优秀的个人博客,低调大师

Kubernetes 一指禅,文章集锦(实时更新)

Kubernetes不简单,阿里云容器服务团队希望能通过这篇集锦助你一臂之力~你还有哪些学习和使用的困惑?请留言给我们哦~ Kubernetes 的ABC与解读 Kubernetes与Docker基本概念与常用命令对照https://yq.aliyun.com/articles/385699 简化 Kubernetes Yaml 文件创建https://yq.aliyun.com/articles/341213 Minikube - Kubernetes本地实验环境https://yq.aliyun.com/articles/221687 利用Helm简化Kubernetes应用部署https://yq.aliyun.com/articles/159601 Kubernetes的Device Plugin设计解读https://yq.aliy

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册
修改密码
忘记密码