zoukankan      html  css  js  c++  java
  • spring boot app

    一个demo  可以参考一下

    AppConfig

    @Configuration
    @ComponentScan(basePackages = { "org.whm.test" })
    @EnableAutoConfiguration
    public class AppConfig {
    
        public static void main(String[] argss) {
            String[] args = { "--spring.config.location=classpath:config/app.yml" };
            SpringApplication.run(AppConfig.class, args);
        }
    
    }

    pom.xml

        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.4.RELEASE</version>
        </parent>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-aop</artifactId>
            </dependency>
            
        </dependencies>

    app.yml

    server: 
      port: 8099 
      session-timeout: 30
      tomcat.max-threads: 0
      tomcat.uri-encoding: UTF-8
      
    spring: 
      aop: 
        auto: true 
      datasource:  
        url : jdbc:mysql://localhost:3306/newbirds
        username : root
        password : mymysql
        driverClassName : com.mysql.jdbc.Driver
      jpa:  
        database : MYSQL
        show-sql : true
        hibernate: 
          ddl-auto : update
          naming-strategy : org.hibernate.cfg.ImprovedNamingStrategy
        properties: 
          hibernate: 
            dialect : org.hibernate.dialect.MySQL5Dialect

     启动 : mvn spring-boot:run 或者 直接运行main 方法

  • 相关阅读:
    使用gulp搭建less编译环境
    用原生js封装轮播图
    NodeJS
    npm使用入门
    漫谈JS 的继承方式
    同源策略、跨域解决方案
    脚本学习一(echo、echo off、@、start)
    统计英文文档里每个单词出现的次数
    Dijkstra算法和Floyd算法的正确性证明
    Prim算法和Kruskal算法的正确性证明
  • 原文地址:https://www.cnblogs.com/whm-blog/p/7239109.html
Copyright © 2011-2022 走看看