Tags: project start ATI group New request Web real default file configurationSpring Boot CaseFirst we prepare a spring boot using MySQL small scene, we do such an example, using Spring boot to do a WEB application, provide a metho
picture description650) this.width=650; "src=" Http://www.kaigejava.com/res/plugins/ueditor/themes/default/images/spacer.gif "alt=" Spacer.gif "/>Explanation of @EnableAutoConfiguration notes:View source code and notes for this note:650) this.width=650; "Src=" http://image.uc.cn//s/wemedia/s/upload/2017/ Bb26c88b847889617d74d3592170178dx1863x781x58.png "alt=" bb26c88b847889617d74d3592170178dx1863x78 "/>Please click here to enter the picture description650) this.width=650; "src=" Http://www.kaig
Spring Boot series (iii) Spring boot common annotations
@RestController and @requestmapping
@RestController is called a stereotype (stereotype) annotation. It provides suggestions for developers who read the code. For spring, this class plays a special role. It inherits fro
This example describes the Java Development Spring Connection database method. Share to everyone for your reference, specific as follows:Interface:
Package cn.com.service;
Import java.util.List;
Import Cn.com.bean.PersonBean;
Public interface Personservice {
//Save the public
void Save (Personbean);
Update public
void update (Personbean person)
object and use the @bean callout as the spring bean
Here's an example that returns the Graphqlschema object directly in a simplified manner as follows:
@Bean
Graphqlschema schema () {
String schema = "type Query {hello:string}";
Schemaparser schemaparser = new Schemaparser ();
Typedefinitionregistry typedefinitionregistry = schemaparser.parse (schema);
Runtimewirin
problems are gone, and your productivity will improve a lot, because spring boot has helped you get a project prototype, you just need to add your own business code to this prototype, your service And DAO will be all right!Is spring boot really that bad? OK, let's get to the bottom and talk about how to build a projec
.
@ EnableAutoConfigurationWith @ Import (EnableAutoConfigurationImportSelector. class), The META-INF/spring. factories will be scannedAll org. springframework. boot. autoconfigure. EnableAutoConfiguration. For further scanning.
Complete.
mvn clean install
Create a new project. Introduce the package project
@Autowired private StringRedisTemplate redisTemplate;
That's easy.
Most of the time we want to expan
This section will delve into the details of spring boot to learn the main features of the spring boot that you want to use or customize.1. SpringapplicationThe Springapplication class provides a convenient way to guide a spring application, which is opened from the main meth
I. Adding a REDIS cache 1. Adding Redis start-up dependenciesAdd spring boot support for Redis dependency configuration in Pom.xml, as follows: org.springframework.boot spring-boot-starter-redis 1.4.7.RELEASEHttps://mvnrepository.com/artifact/org.springframework.boot/sprin
of records affected by this operation. NBSP;2, the result of executing a query returns a resThe Ultset object. ?resultset contains all rows that conform to the conditions in the SQL statement, and it provides access to the data in those rows through a set of Get methods. ? get data using the access method of the result set (ResultSet) object://while (Rs.next ()) {//stringname= Rs.getstring ("name") ;//stringpass=rs.getstring (1) ;// This method is more efficient// }// (column is numbered from l
It is believed that many developers who have used spring know that spring provides a very useful JavaMailSender interface for sending mail. An automated configuration is also provided for this in the Spring Boot starter module. Here's an example of how to use Send mail in
automatic configuration (auto-configuration)
Automatic configuration (auto-configuration) is one of the most important features of spring boot, because the feature is based on the classpath of the application (this is mainly based on Maven Pom.xml decision), annotations and some other Java configuration descriptors automatically configure the spring
Spring boot also encapsulates the NoSQL database by automating the usual database support.About RedisRedis is the most widely used memory data store in the industry today. Supports a richer data structure than memcached,redis, such as hashes, lists, sets, etc., while supporting data persistence. In addition to this, Re
In addition to the automatic configuration changes used in the first article using overwrite, you can also change the runtime configuration of your app with the Application.properties file provided in Spring Boot. This configuration is very granular in the way it is configured. application.properties In the Spring Boot
Deploy an open source project Cloud collection in just three steps to create your own personal collection system, which is simple!The Cloud Collection project has been open source for more than 2 years, as the initial learning Spring Boot practiced hand project, using a lot of very new technology, now it seems that many new technologies are not necessary to use, but as a learning case is really a good
dependencies between the application libraries. This means that if you create a project with a specific Spring IO version, you no longer need to define the version of the library. Even the spring boot startup Project is part of this spring IO. For example, if you are using
support, cache dependent Spring-context-support, integration Ehcache required dependencies, JPA operations database, MySQL Database-driven, specific Pom.xml files:
xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
After introducing this, the relevant introduction does not need to add the ver
database connection pool selection algorithm
By default, database connections can be configured automatically using the DataSource pool. Here is an algorithm for selecting a specific implementation: because of the performance and concurrency of the Tomcat data source connection pool, we always use it preferentially when Tomcat is available. If HIKARICP is available, we will use it. If Commons DBCP is avail
The main contents of this chapter:With previous learning, we learned and quickly completed the first spring boot application. Spring Boot Enterprise Framework, then how does spring boot read static resources? such as JS folder, CS
is being modified, and the document and code are in two different mediums, which can easily lead to inconsistencies unless there is a strict management mechanism.
To solve this problem, this article introduces the Swagger2 partner of the RESTful API, which can easily be integrated into spring boot and organize a robust RESTful API document with the Spring M
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.