Read about spring configuration file example, The latest news, videos, and discussion topics about spring configuration file example from alibabacloud.com
1. Introduction
Under the SSH framework, suppose we put the configuration file under the Src/datasource.properties path of the project, and the spring configuration file is also src/ Applicationcontext.xml path, then we can read the conf
: The above path is just an example, specific use or to the real project, do the programming of this point extrapolate ability or some of itIn the development process, if spring's configuration file applicationcontext.xml is not loaded, the general return of such errorsCould not open ServletContext resource [/web-inf/applicationcontext.xml]Here's a common way for
problem
In a large project structure, the Spring ' s bean configuration files is located at different folders for easy Maintainabil ity and modular. For Example,spring-common.xml in Common folder, Spring-connection.xml in Connection folder,
Spring (11)-use Aspectj aspect configuration and XML configuration file to implement aspect ProgrammingException
Some exceptions were encountered during use. I used the latest Spring version, Spring-4.2.5 version. First, make sure
The Spring boot configuration file is available in two formats: Application.properties and APPLICATION.YML. Only one of the two profiles needs to be used.There are some differences in the syntax of the two configuration files, as follows1. Application.propertiesServer.port = 8080--Tomcat portServer.context-path =/webna
Category: "java"2013-12-09 16:29 1020 People read reviews (0) favorite reports 1. IntroductionUnder the SSH framework, suppose we put the configuration file under the Src/datasource.properties path of the project, and the spring configuration file is also src/ Applicatio
I. benefits of multi-environment configuration:1. different environment configuration can be configured with different parameters ~2. Easy to deploy, improve efficiency, reduce error ~Two. Properties Multi-environment configuration1. Configure activation optionsSpring.profiles.active=dev2. Add additional ProfilesApplication.properties:#激活哪一个环境的配置文件spring. profile
="Org.springframework.beans.factory.config.PropertiesFactoryBean">2"Locations">34 5 6789"Propertyconfigurer" class="Org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">Ten"Properties" ref="Configrealm"/> OneIf you have more than one, you can add it in the list similar to the red part!Here, say a little more, XML configuration problem, of course, not a functional problem, but the habit of the probl
The Spring Framework is the practice of the IOC (inversion of control inversion) principle. IoC is also known as Dependency Injection (DI dependency injection).Org.springframework.beans and org.springframework.context Two packages implement the IOC container. BeanFactory接口的子接口 ApplicationContext defines the basic functionality of the container. If the Web app is using the WebApplicationContext .The function of this container is to parse and instanti
One1. When the configuration file is XML, the slice class does not write AOP anotation1 PackageCom.springinaction.springidol;2 3 Public classMagicianImplementsMindReader {4 PrivateString Thoughts;5 6 Public voidInterceptthoughts (String thoughts) {7SYSTEM.OUT.PRINTLN ("Intercepting volunteer ' s Thoughts");8 This. Thoughts =thoughts;9 }Ten One PublicString getthoughts () { A returnthou
This article summarizes the basic configuration of spring MVC by first pasting a directory of my projects, with some extra files that you don't have to care about:Some of the jar bags used in this:Next is the configuration of Web. XML:Next is Springmvc-servlet.xml:These are the most basic configurations of spring MVC,
configuration information) postprocessbeanfactory Load Properties Property file before
Spring provides the interface for Applicationcontextinitializer, which implements the interface
public class Customerapplicationcontextinitializer implements applicationcontextinitializer
In addition, you need to configure this class in Web.xml
Because in Customizecon
data is written continuously*/public void Testinputsream (String dir) {FileInputStream FIP = null;Bytearrayoutputstream ba = null;DataInputStream os = null;try {FIP = new FileInputStream (New File (dir + "/new text document. txt"));ba = new Bytearrayoutputstream ();OS = new DataInputStream (FIP);byte[] b = new byte[1024];int rs;While ((rs = Os.read (b))! =-1) {//reads data from the input stream into byte Group BBa.write (b, 0, RS);//write Method B is
SpringDataSource# Local Libraryurl:jdbc:mysql://192.168.18.7:3306/shiptrackersmart?useunicode=truecharacterencoding=utf-8 Zerodatetimebehavior=converttonull# Official Library# url:jdbc:mysql://192.168.3.141:3306/shiptrackersmart?useunicode=truecharacterencoding=utf-8 Zerodatetimebehavior=converttonullUsername:rootPassword:rootDriver-class-name:com.mysql.jdbc.driverType:com.alibaba.druid.pool.DruidDataSourceDruidMax-active:20Initial-size:1Min-idle:3max-wait:60000time-between-eviction-runs-millis:
Strictly speaking, the contents of this blog post are not necessarily related to this series, the theme of this blog post is: How to use spring to get information about properties files. The use cases used in this blog post are related to this series, so let's put it here.
Through spring's configuration (applicationcontext.xml), such as:
# Oracle Configuration
Spring Catalog File Overview:
List of jar packages required:
After the jar is imported, you will need to build path, select the jar right key build path-"Add Build Path"
First create Persion.java
Package Com.hpe.po;
public class Person {
//requirement, the
Print method ends public
void Eat ()
after the Print method starts//prints eating only after the eating is hit System.out.println ("Eat ...");
Previous ArticleArticleAbout the use http://blog.csdn.net/kongxx/archive/2010/08/26/5842009.aspx of propertyplaceholderconfigurer class in spring
However, in some cases, our properties are not configured in the properties file, but are set in the Java System Environment through the-dname = value parameter at Java startup, in this case, we can use system. getproperty (name) to get the property value, and i
Since the beginning of the Java Web to learn the SSM framework now, configuration files are often another headache for me. Personally a bit obsessive-compulsive disorder, if which xsi:schemalocation version is wrong, or add superfluous statement, I am not comfortable. But you have to add a blank XML first, and then copy the declarations that you have organized. Today, when we look at the SSM learning tutorial, I see that some people have the same ques
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.