To understand the spring-boot of this technique, you should know Spring-boot's core profile application.properties, and of course you can customize the profile **.properties information through annotations.
I. Reading the contents of the core profile information Application.properties
A core profile is a application.properties or application.yml configuration fil
The process of 1.Spring development1> First stage: XML configuration (XML configuration files need to be divided into different configuration files);2> second Stage: annotation configuration (provides annotations for declaring beans, such as @component, @Service, a basic configuration such as database configuration with XML, business Configuration annotated);3> third stage: Java configuration (Java configur
Spring Cloud FeignSpring Cloud Feign is a set of declarative service invocation clients based on the Netflix feign implementation. It makes writing Web service clients easier. We only need to configure it by creating an interface and using annotations to complete the binding to the Web service interface. It features pluggable annotation support, including feign annotations, Jax-rs annotations. It also supports pluggable encoders and decoders.
use spring Initializr in IntelliJ to quickly build a spring boot projectNew---ProjectYou can see the Create features window as shown in the figure. Initial Service Urlthe address that points to is spring's official spring INITIALIZR tool address, so the project created here is actually based on its web tool, or it can
1.Integration of timed tasks in spring bootIn the Startup class, add an annotation that opens a timed task:The use of timed tasks in Springboot is fairly straightforward. First, we add @enablescheduling to the startup class to open the timed task.@EnableScheduling Public class startapplication { publicstaticvoid main (string[] args) { Springapplication.run (startapplication. class , args);} }2. Then we directly create the se
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
directory @PropertySource
This annotation can specify a specific property configuration file with a lower priority. springapplication.setdefaultproperties
For example:
Springapplication application = new Springapplication (application.class);
map1 2 3 4 5 6 1 2 3 4 5-6
apply (use) Properties
@Value ("${xxx}")
This is the simplest way to inject attribute values through @value annotations. @ConfigurationProperties
article will introduce a simple sample of the development process based on this project.For feature development with spring boot, you need to use Gradle or Maven as the build tool. In this example, we'll use Eclipse and Maven plug-ins for development. To use spring Boot, fi
engine (no separate Web server required), the service should start on its own at the command line, and be accessed immediately through the exposed HTTP port.Concurrency: To initiate more micro-service instances to scale horizontally when demand increases.Can be arbitrarily disposed of: you can start and stop as needed.The development environment is equivalent to the production environment: minimizing the gap between all the environments in which the service runs.LOG: Use the tool to log and vie
http://blog.csdn.net/qq18998401056/article/details/53467671**************************************************************************In spring boot, the appropriate cache manager (CacheManager) is configured with @enablecaching annotation automation, and Spring boot detects the cache provider according to the following
Spring boot starts on the first day, see the example of @restcontroller ....The same point: both are used to indicate whether a class in spring can receive HTTP requestsDifferent points: @Controller identify a spring class that is a 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
included in the Mybatis-spring-boot-starter
Configure MySQL's connection configuration in Application.properties as described previously with JDBC and spring-data connection databases
Spring.datasource.url=jdbc:mysql://localhost:3306/test
Spring.datasource.username=root
Spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
UTF-8 encoding relies on the management module, You can omit the
The POM project only supports single inheritance, but sometimes we have to inherit from other Pom, or use our own configuration. At this point, if we want to add support for Spring Boot, it can be done in other ways.
We can do dependency management by introducing spring-
applied and installed into several different environments, such as: development, testing, production, etc. Each environment's database address, server port and so on configuration will be different, if you are packaging for different environments to frequently modify the configuration file, it will be a very cumbersome and prone to error.For a multi-environment configuration, the basic idea of a variety of project building tools or frameworks is cons
overrides the parameters in the configuration file * If no value is specified, then the default value for name is world. */@ Value ("${Name: World}") private String name; /** * Due to the use of @restcontrolelr, it is not necessary to use @responsebody to label the returned results */@ requestmapping ("/Hello") public String SayHello () { return String. Format ("hello:%S", name);}} To write a spring boot
; - - @Target ({elementtype.type}) - @Retention (retentionpolicy.runtime) + @Documented - @Inherited + @Configuration A @EnableAutoConfiguration at @ComponentScan - Public@Interfacespringbootapplication { -Classdefault {}; - -String[] Excludename ()default {}; -}springbootapplication Source@SpringBootApplication annotations are mainly composed of @configuration, @EnableAutoConfiguration, @ComponentScan If you do not use @springbootapplication annotations, you can use @configuration, @EnableAu
";}}@RequestMapping: Provides routing information that is responsible for mapping the URL to a specific function in the controller.@EnableAutoConfiguration: Spring Boot automatic configuration (auto-configuration): Try to automatically configure your spring app based on the jar dependencies you add. For example, if HSQ
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.