Spring boot testing and deployment method, springboot
Many netizens may ask me from time to time how to test the spring boot project, how to deploy the project, and whether there is any good Deployment Solution in production? This article introduces how to develop, debug, and package
Friends who are just concerned, can review the first two articles:
Basic application Development
Distributed Application Development
The last article summarizes the second part of "in-depth practice spring Boot", which summarizes the third and final part of this article. This part mainly explains the core technology source code analysis, because the length and the ability reason, the analy
item in Spring.factories (the full path of the class) as the Spring boot configuration class
Spring Boot This concept of "convention over configuration" can greatly simplify the writing of configuration code. So, we can follow the above routines to write a Spring-
Redis
Redis is a cache, Message Queuing, and multiple types of key-value storage services.
Spring Boot
Spring boot provides automatic injection configuration for lettcue and Jedis clients, and provides abstract interfaces through Spring-data-redis
Use Maven to get detailed explanation of the first Spring Boot program, mavenspring
Preface
To learn a new technology, don't worry about its principles, procedures, how to organize code or something. Copy a demo directly from the official website or blog, and run it on your own. Then, you can easily understand the pile of explanations.
At present, there are a lot of articles on
After the last article, HelloWorld program we have created a hellcontroller, which contains a response to the JSON method, this article for the controller to do a bit more explanation.Recalling the previous article, we used @RestController annotations in the controller, which was introduced in Spring 4.0. Check the source to see that it contains @Controller and @ResponseBody annotations. We can understand it as an enhanced version of @Controller. Spec
Static resource accessWhen we develop Web applications, we need to reference a large number of JS, CSS, pictures and other static resources.Default configurationSpring boot defaults to provide a static resource directory location to be placed under Classpath, and the directory name must conform to the following rules:/static/public/resources/meta-inf/resourcesExample: We can create a static in the src/main/resources/directory, where a picture file is
-service calls in spring cloud.Let's look at a concrete example of how to use the Spring Cloud Ribbon to implement service invocation and client-side load balancing.Give it a try.In the following example, we will use the previously built as a service registry as a service eureka-server eureka-client provider as the bas
配置server.context-path=/myspringboot# 错误页,指定发生错误时,跳转的URL。请查看BasicErrorController源码便知server.error.path=/error# 服务端口server.port=9090# session最大超时时间(分钟),默认为30server.session-timeout=60# 该服务绑定IP地址,启动服务器时如本机不是该IP地址则抛出异常启动失败,只有特殊需求的情况下才配置# server.address=192.168.16.11TomcatTomcat is the default container for spring boot, and here are a few common configurations:# Tomcat Maximum number of threads, default isserver.t
In the case of beginners spring boot , the official example is for us to inherit a spring spring-boot-starter-parent , the parent:parent> groupId>Org.springframework.bootgroupId> artifactid>
documentation. English version of the above, from the perspective of performance, can be moved from log4j to Logback as soon as possible.
Default log Logback:
By default, Spring boot uses logback to log logs and output to the console using the info level. You should already see a lot of info-level logs when running applications and other examples.
As you can see from the diagram above, the log output cont
Spring Boot attribute configuration and custom attribute Configuration
In the process of using spring boot, we can find that the project can complete the corresponding functions with only a few configurations, thanks to the modular configuration in spring
/M02/A6/08/wKioL1nIVrSD3SqIAAA5sN-Euv8996.png "title=" 001. PNG "alt=" Wkiol1nivrsd3sqiaaa5sn-euv8996.png "/>the above-described JdbcTemplate just a few of the most basic operations, more information on the use of other data access operations please refer to: JdbctemplateapiHttps://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jdbc/core/JdbcTemplate.htmlwith this simple example above, w
The structure of this article:-What is Springdata JPA-Springboot Integrated Spring data JPA
The core interface of Spring Data repository is repository (it seems to be nothing to be surprised). This interface requires the domain class with the ID type of the domain class as the parameter. This interface is primarily for you to know the type of interface that inherits this class. Crudrepository provides som
obtained from the SSL Certificate Authority center. This example demonstrates the generation of a self-signed certificate.Each JDK or JRE has a tool called keytool, which is a certificate management tool that can be used to generate self-signed certificates.After configuring the Java_home and adding the Java_home bin directory to path, you can invoke the command on the Console:Keytool-genkey-alias Tomcat?At this point we generate A. keystore hidden f
JdkSerializationRedisSerializer by default, which means that both the key and value are serialized through Java. StringRedisTemplate uses StringRedisSerializer by default.
For example, if RedisTemplate is used, we want to serialize the value of the Product type to JSON, and the key is of the String type. The setKeySerializer () and setValueSerializer () Methods of the RedisTemplate must be as follows:
@ Bean public RedisTemplate redisTemplate (RedisC
Uploading files is one of the most frequently used scenes in the Internet, and the most typical case is uploading avatars and so on, today with a small case that takes everyone to do a spring boot upload file.1, POM package configurationWe use the latest version of Spring boot 1.5.9, JDK use 1.8, tomcat8.0. Org.spri
and we need to access them via the POST method.
Endpoints. Shutdown. Enabled=true
Customizing EndpointsEndpoints can be customized in the Spring Boot configuration file. For example, above, we open the shutdown endpoint.
Endpoints. Shutdown. Enabled=true
The prefix for the endpoint is, Endpoints + "." + END name.The defa
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.