the Bean based on conditions such as jar packages, classes, and configuration files in the project classpath, such as: If the classpath has MyBatis and Oracle driver packages, Springboot automatically configures beans such as MyBatis's data source factory . Spring Boot's automatic assembly is implemented primarily through conditional configuration and annotations, which is the magic of Springboot. Simply put, what you need to add dependencies, as lo
this, we need to configure Tomcatembeddedservletcontainerfactory and add Tomcat's Connector to implement it.At this point we need to add the following configuration in the configuration file: packagecom.wisely.ch7_4;Importorg.springframework.boot.SpringApplication;Importorg.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public classch74application { public Static voidmain (string[] Args) {springapplication.run (ch74application.class, args); } @Bean publicembedd
The 1th Chapter Spring Boot Introduction1-1 Spring Boot Blog _ Course GuideWhat is 1-2 Spring Boot?2nd. Opening Spring Boot's first WEB project2-1-Initialize the first web project2-2-Co
controllersrc/mainunder Create a new package cn.zxuqian.controllers and create a new class in it, name HelloController and add the following code:package cn.zxuqian.controllers;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestControllerpublicclass HelloController { @RequestMapping("/") publicindex() { return"Hello World!"; } }
@RestControllerMark this class as a rest controller and be rea
Spring Boot Basics Tutorial1th QuarterInstallation and use of toolsSpring Boot Documenthttps://qbgbook.gitbooks.io/spring-boot-reference-guide-zh/content/I.%20Spring%20Boot%20Documentation/I. Tools used in the courseSpring Tool Suite:https://spring.io/tools/sts/allEclipse:ht
configuration file:Management.context-path=/endpointsTo start the test:3.6 Endpoint Protection3.3.6.1 using springsecurity configuration ItemsApplication security mechanism, we can use Spring security,Spring security is for the entire application, after use to access the application, the HTTP Basic Authentication dialog box will pop up. L Join DependencyL Join ConfigurationSecurity.user.name=adminSecurity.
4. JSP The custom error page cannot overwrite the spring boot default error page
Four. Jsp Demo to Add configuration parameters:Spring.mvc.view.prefix:/web-inf/templates/Spring.mvc.view.suffix:. jspFollow the public number:650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/89/89/wKiom1gW9oDDdQUFAABtN-e5hXo162.jpg "title=" Dragon Fruit Academy qr code. JPG "alt=" wkiom1gw9odddqufaabtn-e5
("From Production profiles"); }}4> test (Src/test/java) Packagecom.wisely.highlight_spring4.ch3.fortest;ImportOrg.junit.Assert;Importorg.junit.Test;ImportOrg.junit.runner.RunWith;Importorg.springframework.beans.factory.annotation.Autowired;ImportOrg.springframework.test.context.ActiveProfiles;Importorg.springframework.test.context.ContextConfiguration;ImportOrg.springframework.test.context.junit4.SpringJUnit4ClassRunner; the @RunWith (Springjunit4classrunner.class)//Springjunit4classrunner prov
Spel
N
Y
ProfilesSpring profile can divide the application's configuration into multiple parts, only in the specified environment. Any @component or @configutaion can use @profile to restrict its loading, for example@Configuration@Profile("production")public class ProductionConfiguration {// ...}You can use spring.profiles.active the Environment variable settings to activate which profile. For example, setting in Application.propertiesspring.profiles.active=d
values for No limit) spring.redis.pool.max-active=8# connection pool maximum blocking wait time (using negative values means there is no limit) spring.redis.pool.max-wait=-1# The maximum idle connection in the connection pool spring.redis.pool.max-idle=8# the minimum idle connection in the connection pool spring.redis.pool.min-idle=0# connection time-out (in milliseconds) spring.redis.timeout =0 Where the configuration of spring.redis.database usually uses 0, Redis can set the number of databa
Spring Boot war package instance tutorial, springwar
In addition to executable jar packages, Spring Boot also supports traditional war packages. This article describes how to use Spring Boot
Intellij IDEA graphic tutorial for creating a spring-boot project,
Development Environment:
Jdk: jdk 8
Maven: maven-3.5.2
Development Tool: Itellij IDEA 2017.1.
Prerequisites: you have installed the above software and configured the jdk and maven environment variables.
Procedure:
Click Upload file --- Select new --- and click project..., as shown in:
Cli
1: It is easy to read the configuration of the custom properties in the Application.properties, so there are not too many descriptions here:Custom properties and loadingFor example, define the following properties:
com.blog.title=spring Boot Tutorial
The corresponding configuration properties are then loaded by @Value ("${Property Name}") annotations, as follows
"Video Communication Platform"
Àspringboot Video
Http://study.163.com/course/introduction.htm?courseId=1004329008utm_campaign=commissionutm_source= 400000000155061utm_medium=share
Àspringcloud Video
Http://study.163.com/course/introduction.htm?courseId=1004638001utm_campaign=commissionutm_source= 400000000155061utm_medium=share
àspring Boot Source
Https://gitee.com/happyangellxq520/spring-
Jedisconnectionfactory ();
}
@Bean public
redistemplate
After the configuration is completed, write the test case experiment effect@RunWith (Springjunit4classrunner.class)
@SpringApplicationConfiguration (application.class) Public
class applicationtests {
@Autowired
private redistemplate Of course the data operations provided in Spring-data-redis are much more than this, this article is only used as a configuration reference w
Spring boot uses properties to define the short message template method tutorial, springproperties
Preface
We usually encounter requirements such as text message sending and email sending during development. The sending content is often provided by the customer as a template. If We splice strings in the program to fix this template, obviously, it is a kind of pra
())); } @Scheduled (Cron= "0 28 11?" * *" )//use the Cron property to execute at a specified time, which in this case is 11:28 execution; Cron is a scheduled task under Unix and Unix-like systems (such as Linux) Public voidfixtimeexecution () {System.out.println ("At specified time" + Dateformat.format (NewDate ()) + "? Execution"); }}2GT; Configuration class Package Com.wisely.highlight_spring4.ch3.taskscheduler; Import Org.springframework.context.annotation.ComponentScan; Import org.sp
--- [ restartedMain] com.ysl.jna.jna.JnaApplicationKt : Started JnaApplicationKt in 7.447 seconds (JVM running for 8.208)Indicates that your app has started successfully; the second-to-last line of debugging information is as follows:2017-12-23 13:30:39.642 INFO 6788 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ‘‘You will see spring
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.