Read about spring configuration file example, The latest news, videos, and discussion topics about spring configuration file example from alibabacloud.com
1.1. ClasspathProject CatalogueThe Web. xml file is configured as follows:
Configure the core servlet of springMVC -- servlet > Servlet-name >Springservlet-name> Servlet-class >org.springframework.web.servlet.DispatcherServletservlet-class> Init-param > Param-name >contextconfiglocationparam-name> Specifies that the path to the springMVC configuration f
Before starting the topic of this blog, let's take a look at the spring configuration file and what's involved.Photo from: http://book.51cto.com/art/201004/193743.htm (thank you)Spring allows us to configure its container context property values through an external property file
/cache/spring-cache-3.1.xsd Http://www.springfram EWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/spring-aop.xsd Http://www.springframework.org/sch Ema/util http://www.springframework.org/schema/util/spring-util.xsd "> automatically scan Web packages, incorporating annotated classes into Spring co
explicitly specifying collaborators can make the configurations more flexible and clearer, we recommend that you use this configuration for large deployment configurations. To some extent, it is also a document form of system architecture.
Byname
Automatic Assembly Based on Attribute names. This option checks the container, finds the bean exactly the same as the property by name, and automatically assembles it with the property. For
Org.springframework.web.bind.annotation.requestmapping;import Org.springframework.web.bind.annotation.requestparam;import entity. User; @Controller//Struts-like Actionpublic class TestController {@RequestMapping ("test/login.do")//Request URL address mapping, similar to Strut s action-mapping public string Testlogin (@RequestParam (value= "username") string username, string password, HttpServletRequest request) {//@RequestParam means the parameters that must be included in the requested URL add
First, create a spring projectProject Name: spring101306Ii. adding a jar package to the project1. Create a Lib directory in your project/lib2. Add spring support under the Lib directoryCommons-logging.jarJunit-4.10.jarLog4j.jarMysql-connector-java-5.1.18-bin.jarSpring-beans-3.2.0.release.jarSpring-context-3.2.0.release.jarSpring-core-3.2.0.release.jarSpring-expression-3.2.0.release.jarSpring-jdbc-3.2.0.rele
1. Name can be defined by itself Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xmlns:context= "Http://www.springframework.org/schema/context"Xmlns:jdbc= "Http://www.springframework.org/schema/jdbc"Xmlns:jee= "Http://www.springframework.org/schema/jee"xmlns:tx= "Http://www.springframework.org/schema/tx"Xmlns:jpa= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/DATA/JPA"Xmlns:util= "Http://www.springframework.org/schema/util"Xmlns:mvc= "Http://www.springframework.org/schema/mvc"Xsi:schemalocation=
1, normal spring project use Logback default with the properties file as a configuration variable.2, if you want to use the Yaml file, then can be converted to spring boot project, natural seamless integration3, no way, if the project co
File uploads are inherently simple to configure in Spring-boot , but there is a problem with multiple file transfers and single delivery.The two configurations are slightly different, and there are some things that make me this technology small white very easy to step on the pit.Important points:The upload is a single file
How the configuration file is loaded in spring
There are 3 ways to load an XML configuration file in spring, and XML is the most common spring application
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
Add toXML File ErrorError:The prefix "cache" for element "Cache:annotation-driven" was not bound.Solve:Add red and bold contentXmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"xmlns:tx= "Http://www.springframework.org/schema/tx" xmlns:jdbc= "Http://www.springframework.org/schema/jdbc"xmlns:context= "Http://www.springframework.org/schema/context"Xmlns:mvc= "Http://www.springframework.org/schem
Reprinted from:https://blog.csdn.net/qq_21387171/article/details/53876721https://blog.csdn.net/catoop/article/details/50548009http://blog.didispace.com/springbootproperties/ Custom properties and loading
In Application.properties, you can customize some properties and then load the corresponding configuration properties by @value ("${Property Name}") annotations. references between Parameters
You can also use a direct reference between the various par
Before starting the topic of this blog, let's take a look at the spring configuration file and what's involved.
Photo from: http://book.51cto.com/art/201004/193743.htm (thank you)
Spring allows us to configure its container context property values through an external property
follows:Com.didispace.blog.name= Program Ape ddcom.didispace.blog.title=spring Boot Tutorial @Value("${属性名}")the corresponding configuration properties are then loaded with annotations, as follows:@Componentpublic class Blogproperties { @Value ("${com.didispace.blog.name}") private String name; @Value ("${com.didispace.blog.title}") private String title; Omit getter and Setter} By conventi
">Bean> A - - Bean that configures facets - the BeanID= "Loggingaspect"class= "Com.yl.spring.aop.xml.LoggingAspect">Bean> - - BeanID= "Validationaspect"class= "Com.yl.spring.aop.xml.ValidationAspect">Bean> - + Configuring AOP - - Aop:config> + To Configure a pointcut expression - A Aop:pointcutexpression= "Execution (public int com.yl.spring.aop.xml.arithmeticcalculator.* (..))"ID= "Pointcut"/> at Configure facets and notifications
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.