The use of Boot Spring transactions

Boot Spring is very simple to use, first of all to use the annotation @EnableTransactionManagement open transaction support, and then in the access database Service method to add notes @Transactional. On the transaction manager, whether it is JPA or JDBC, etc. to achieve a self interface PlatformTransactionManager if you add a spring-boot-starter-jdbc dependency, the framework will...
read(408) comment(1)

Boot Spring deployment and service configuration

Boot Spring its default is the integration of the web container, starting from the same as the ordinary Java program, main function entry start. Its built-in Tomcat container or Jetty container, specifically determined by the configuration (default Tomcat). Of course, you can also package the project into a war package, into an independent web container (Tomcat, Weblogic, etc.), of course, before you want to do a simple adjustment of the program entrance. Project construction we use Maven or Gradle, which will enable the project to rely on, jar package management, as well as packaged deployment...
read(607) comment(1)

Boot Spring dynamic data source (automatic switching of multiple data sources)

This paper realizes the case scenario: A system in addition to the need to read from the database and data management and a part of the business relates to other databases, requirements can be in any method can be flexibly specified specific to the operation of the database. In order to use with the simplest method in development, based on annotations and AOP method to achieve, in spring boot framework of the project, add the code after the class, only need to configure data source can be directly through the annotation using, simple and convenient. A configuration two use 1 configuration files in the configuration of multiple data sources 2 in need...
read(510) comment(0)

Boot Spring multi data source

The retrospection of the article introduces how to manually using java code to register the object to the spring, to the "multi data sources are based. Following a Java class is I've written according to dynamic configuration file to create multi datasource code and its principle is very simple, is to read the configuration file, according to the number of data sources that are configured in the configuration file dynamically created datasource and registered to the spring. The code is as follows: org.springboot.sample.config import; JAV package...
read(719) comment(0)

Boot Java uses the Spring code to create the Bean and register it with the Spring.

From the beginning of the Spring3.0, adding a new way to configure Definition Bean, which is through the Code Java configuration Definition Bean. XML and annotation two configurations with different point is that both XML and annotation is configured for predefined manner that developers through various attributes of an XML file or annotation predefined configuration bean, start the spring container, spring...
read(804) comment(0)

Boot MyBatis Spring connection database

Recently quite was busy, before pumping time to be integrated to send out, in fact, mybatis official website in 2015 by the end of November has released the SpringBoot integrated the release version, GitHub Code: https://github.com/mybatis/mybatis-spring-boot In front of the JPA and JDBC connection database to do a description, this paper is also a reference to the official code to do a summary. First say a digression, SpringBoot use the default org....
read(685) comment(2)

Boot Spring environment variable read and attribute object binding

Any class that is managed by the setEnvironment, the implementation of the interface EnvironmentAware rewriting method Spring can be started in the project, access to the system environment variables and variables in the application configuration file. Such as: @Configuration Class MyWebAppConfigurer implements EnvironmentAware public { Stati private...
read(467) comment(0)

Boot Spring integrated Shiro and CAS

Please look at this article, the first to understand the following points of knowledge: 1, Shiro is what? How to use? 2, Cas is what? How to use? 3, it is best to have a Spring based on the first look at the two articles, according to the content of the 2 articles do it again: Boot Shiro Spring rights management CAS single sign on first look at the following chart below: The first process is simply the use of Shiro process. The second process is simply the use of Cas process. The third diagram is the Shiro integrated Cas after the process. [flow...
read(678) comment(0)

CAS single point landing

First, Tomcat configuration SSL1. to generate key server in order to change to the directory command, in the%TOMCAT_HOME% command line to enter the following commands: -genkey -alias tomcat_key keytool -keyalg RSA -storepass changeit -keystore server.keystore -validity 3600 User name input domain name, such as localhost (development...
read(703) comment(0)

Boot Shiro Spring rights management

Originally intended to write about the database, the integration of MyBatis, just in time to catch up with a friend asked to Shiro rights management, the first summary of the hair out of the. Before using the Spring in MVC Shiro, is through the XML file configuration. Now that you are writing Boot Spring post, Shiro will be applied to Boot Spring, I have completed the local SpringBoot using Shiro example, the configuration method to share. First briefly introduce the Shiro, for the Shiro did not use the...
read(825) comment(4)

Boot JPA Spring connection database

This article will introduce how to add JPA in the Boot Spring project as a persistent way. Modify the pom.xml dependent on an introduction of the JDBC is different from spring-boot-starter-jdbc to spring-boot-starter-data-jpa can be modified, of course, the database driver package is also indispensable, as follows: Mysql</group...
read(613) comment(0)

Boot JDBC Spring connection database

Text will be in the Boot Web construction of Spring applications, based on the MYSQL database of several database connection methods are introduced. Including JDBC, JPA, MyBatis, multi data sources and transactions. JDBC1, attribute profile (application.properties) spring.datasource.url=jdbc:mysql://localhost:3306/test Spring.datasource.username=roo...
read(1643) comment(0)

Boot Spring log SLF4J

Print the contents in the development, the use of System.out.println (Log4j) and should be All the world knows. method. In fact, we do not recommend the development of the use of System.out because a large number of use of System.out will increase the consumption of resources. The Log4j is more flexible in performance is also higher than the System.out, we can configure the output level, you can specify a number of log files were recorded in different log. Using System.out is executed in the current thread, write...
read(888) comment(1)

Boot Spring start loading data CommandLineRunner

In practical applications, we will have to load some data or do some things at the start of the project service. In order to solve this problem, Boot Spring provides us with a way to achieve through the implementation of interface CommandLineRunner. Very simple, just need a class can be, no other configuration. Create the implementation of the interface CommandLineRunner class org.springboot.sample.runner import; ORG package...
read(564) comment(1)

Boot Spring static resource processing

Boot Spring by default provides us with a static resource processing, using the configuration of various properties in WebMvcAutoConfiguration. We recommend that you use the default configuration of Boot Spring, if you need to modify the configuration of special treatment. If you want to completely control the WebMVC, you need to add the @Configuration annotation to the configuration class on the @EnableWebMvc (@SpringBootApplication annotation program entry class already contains @...
read(700) comment(2)
251 data a total of 17 PagesOne Two Three Four Five ... Next page Shadowe
    personal data
    • visit675957 times
    • Integral:Eight thousand and six hundred
    • Grade
    • Rank:1194th name
    • original205
    • Reproduced:36
    • Translation:10
    • Comments:330
    Blog column
    Latest comments