使用IDEA快速搭建基于Maven的SpringBoot项目

迫于好久没写博客心慌慌,随便写个简单版的笔记便于查阅。

新建项目

新建项目 然后起名 继续next netx finish。

首先附上demo的项目结构图

配置pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version> <!-- 我这里用的1.5.9 -->
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.blaze</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
            <version>1.5.9.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.didispace</groupId>
            <artifactId>spring-boot-starter-swagger</artifactId>
            <version>1.1.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.11</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>

        <!-- 分页插件 -->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.5</version>
        </dependency>
        <!-- druid数据库连接池 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.9</version>
        </dependency>
        <!--tomcat-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <!--<version>1.2.4.RELEASE</version>-->
        </dependency>
        <!--fastjson-->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.50</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <finalName>blaze</finalName>
    </build>

</project>

构建demo目录结构

application.properties改成application.yml格式的配置文件

server:
  port: 8080

spring:
  datasource:
    name: mysql_test
    type: com.alibaba.druid.pool.DruidDataSource
    #druid相关配置
    druid:
      #监控统计拦截的filters
      filters: stat
      driver-class-name: com.mysql.jdbc.Driver
      #基本属性
      url: jdbc:mysql://localhost:3306/blaze_test?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
      username: root
      password: root
      #配置连接池 初始化大小/最小/最大
      initial-size: 1
      min-idle: 1
      max-active: 20
      #获取连接等待超时时间
      max-wait: 60000
      #间隔多久进行一次检测,检测需要关闭的空闲连接
      time-between-eviction-runs-millis: 60000
      #一个连接在池中最小生存的时间
      min-evictable-idle-time-millis: 300000
      validation-query: SELECT ‘x‘
      test-while-idle: true
      test-on-borrow: false
      test-on-return: false
      #打开PSCache,并指定每个连接上PSCache的大小。oracle设为true,mysql设为false。分库分表较多推荐设置为false
      pool-prepared-statements: false
      max-pool-prepared-statement-per-connection-size: 20
  #redis相关配置 host把端口加进去(详见RedisConfig的jedisConnectionFactory)
  redis:
    database: 0
    host: 193.168.10.102:6379
    port: 6379
    password:
    timeout: 500
    pool:
      max-idle: 8
      max-wait: -1
      max-active: 8
      min-idle: 0

#mybatis:
#  mapper-locations: classpath:mapper/*.xml
#  type-aliases-package: com.blaze.model

#pagehelper
pagehelper:
  helperDialect: mysql
  reasonable: true
  supportMethodsArguments: true
  params: count=countSql
  returnPageInfo: check

#swagger
swagger:
  title: spring-boot-starter-swagger
  description: Starter for swagger 2.x
  version: 1.1.0.RELEASE
  license: Apache License, Version 2.0
  license-url: https://www.apache.org/licenses/LICENSE-2.0.html
  terms-of-service-url: https://github.com/github-sun/Funs
  base-package: com.blaze.demo
  contact:
    name: blaze
    email: [email protected]

UserDomain.java

package com.blaze.demo.model;

import java.io.Serializable;

/**
 * create by zy 2019/5/30 10:35
 * TODO
 */
public class UserDomain implements Serializable {
    private int id;
    private String userId;
    private String userName;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
}

UserDao.java

package com.blaze.demo.dao;

import com.blaze.demo.model.UserDomain;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * create by zy 2019/5/30 10:28
 * TODO
 */
@Mapper
public interface UserDao {
    //新增user 如果已经存在相同的userName 则不插入数据
    @Insert("INSERT INTO tb_user(id,user_id,user_name) SELECT #{id}, #{userId},#{userName} FROM DUAL WHERE NOT EXISTS (SELECT user_name FROM tb_user WHERE user_name=#{userName})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Transactional
    int insert(UserDomain record);

    //查询
    @Select("SELECT id, user_id as userId, user_name as userName FROM tb_user")
    List<UserDomain> selectUsers();
}

UserService.java

package com.blaze.demo.service;

import com.blaze.demo.model.UserDomain;
import com.github.pagehelper.PageInfo;

/**
 * create by zy 2019/5/30 10:30
 * TODO
 */
public interface UserService {
    /**
     * 新增user
     * @param user
     * @return
     */
    int addUser(UserDomain user);

    /**
     * 分页查询userList
     * @param pageNum
     * @param pageSize
     * @return
     */
    PageInfo<UserDomain> findAllUser(int pageNum, int pageSize);
}

UserServiceImpl.java

package com.blaze.demo.service.impl;

import com.blaze.demo.dao.UserDao;
import com.blaze.demo.model.UserDomain;
import com.blaze.demo.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * create by zy 2019/5/30 10:28
 * TODO
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;//这里会报错,但是并不会影响

    @Override
    public int addUser(UserDomain user) {

        return userDao.insert(user);
    }

    /*
     * 这个方法中用到了我们开头配置依赖的分页插件pagehelper
     * 很简单,只需要在service层传入参数,然后将参数传递给一个插件的一个静态方法即可;
     * pageNum 开始页数
     * pageSize 每页显示的数据条数
     * */
    @Override
    public PageInfo<UserDomain> findAllUser(int pageNum, int pageSize) {
        //将参数传给这个方法就可以实现物理分页了,非常简单。
        PageHelper.startPage(pageNum, pageSize);
        List<UserDomain> userDomains = userDao.selectUsers();
        PageInfo result = new PageInfo(userDomains);
        return result;
    }
}

UserController.java

package com.blaze.demo.controller;

import com.blaze.demo.model.UserDomain;
import com.blaze.demo.service.UserService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * create by zy 2019/5/30 10:28
 * TODO
 * CrossOrigin 允许跨域访问
 */
@Api(value = "", tags = {"用户管理接口"})
@CrossOrigin(maxAge = 3600, origins = "*")
@RestController
@RequestMapping(value = "/user")
public class UserController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private UserService userService;

    @ResponseBody
    @PostMapping("/add")
    public int addUser(UserDomain user) {
        logger.info("-------------blaze add user--------------");
        return userService.addUser(user);
    }

    @ResponseBody
    @GetMapping("/all")
    public Object findAllUser(
            @RequestParam(name = "pageNum", required = false, defaultValue = "1")
                    int pageNum,
            @RequestParam(name = "pageSize", required = false, defaultValue = "10")
                    int pageSize) {
        logger.info("-------------blaze select user--------------");
        return userService.findAllUser(pageNum, pageSize);
    }
}

DemoApplication.java

package com.blaze.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * 此处加上@EnableSwagger2注解 才能使用swagger
 * 加上@EnableCaching 使用redis
 */
@SpringBootApplication
@EnableSwagger2
@EnableCaching
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

}

集成使用redis

配置在application.yml中

RedisConfig.java

package com.blaze.demo.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.MapPropertySource;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisClusterConfiguration;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashMap;
import java.util.Map;

/**
 * create by zy 2019/5/30 14:19
 * TODO
 */
@Configuration
@EnableCaching
public class RedisConfig extends CachingConfigurerSupport {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Value("${spring.redis.host}")
    private String host;

    @Value("${spring.redis.port}")
    private int port;

    @Value("${spring.redis.timeout}")
    private int timeout;

    @Value("${spring.redis.pool.max-idle}")
    private int maxIdle;

    @Value("${spring.redis.pool.max-wait}")
    private long maxWaitMillis;

    @Value("${spring.redis.password}")
    private String password;

    @Bean
    public JedisPoolConfig getJedisPoolConfig() {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        jedisPoolConfig.setMaxIdle(maxIdle);
        jedisPoolConfig.setMaxWaitMillis(maxWaitMillis);
        return jedisPoolConfig;
    }

    @Bean
    public JedisConnectionFactory jedisConnectionFactory() {

        if (host.split(",").length == 1) {
            //单机版
            logger.info("-----------------blaze redis 单机版-------------------------");
            JedisConnectionFactory factory = new JedisConnectionFactory();
            factory.setHostName(host.split(":")[0]);
            factory.setPort(Integer.valueOf(host.split(":")[1]));
            factory.setPassword(password);
            factory.setTimeout(timeout);
            factory.setPoolConfig(getJedisPoolConfig());
            return factory;
        } else {
            //集群
            logger.info("-----------------blaze redis 集群版-------------------------");
            JedisConnectionFactory jcf = new JedisConnectionFactory(getClusterConfiguration());
            jcf.setPoolConfig(getJedisPoolConfig());
            jcf.setPassword(password); //集群的密码认证
            return jcf;
        }
    }

    @Bean
    public CacheManager cacheManager(RedisTemplate redisTemplate) {
        logger.info("===cacheManager successed");
        RedisCacheManager redisCacheManager = new RedisCacheManager(redisTemplate);
        //设置缓存过期时间
        redisCacheManager.setDefaultExpiration(1800);//秒
        return redisCacheManager;
    }

    @Bean(name = "redisTemplate")
    public RedisTemplate<String, Object> getRedisTemplate() {
        logger.info("===redisTemplate successed");
        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
        redisTemplate.setKeySerializer(new StringRedisSerializer());
        redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer());
        redisTemplate.setHashKeySerializer(new StringRedisSerializer());
        redisTemplate.setHashValueSerializer(new Jackson2JsonRedisSerializer(Object.class));
        redisTemplate.setConnectionFactory(jedisConnectionFactory());
        return redisTemplate;
    }

    @Bean
    public RedisClusterConfiguration getClusterConfiguration() {
        if (host.split(",").length > 1) {
            //如果是host是集群模式的才进行以下操作
            Map<String, Object> source = new HashMap<String, Object>();
            source.put("spring.redis.cluster.nodes", host);
            source.put("spring.redis.cluster.timeout", timeout);
            //source.put("spring.redis.cluster.max-redirects", redirects);
            source.put("spring.redis.cluster.password", password);
            return new RedisClusterConfiguration(new
                    MapPropertySource("RedisClusterConfiguration", source));
        } else {
            return null;
        }
    }

}

RedisCommon.java

package com.blaze.demo.utils;

import org.springframework.data.redis.core.RedisTemplate;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;

/**
 * create by zy 2019/5/30 14:33
 * TODO 随便写的 有点简单粗暴 凑合看吧
 */
public class RedisCommon {
    @Resource
    private RedisTemplate redisTemplate;

    public RedisCommon(RedisTemplate client) {
        this.redisTemplate = client;
    }

    /**
     * 值类型 put
     *
     * @param key
     * @param val
     * @return
     */
    public boolean setObjectVal(String key, Object val) {
        try {
            redisTemplate.boundValueOps(key).set(val);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    /**
     * 值类型put 带过期时间
     *
     * @param key
     * @param val
     * @param expries
     * @param timeUnit
     * @return
     */
    public boolean setObjectValExpries(String key, Object val, int expries, TimeUnit timeUnit) {
        try {
            redisTemplate.boundValueOps(key).set(val, expries, timeUnit);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    /**
     * 值类型get
     *
     * @param key
     * @return
     */
    public Object getObjectVal(String key) {
        try {
            return redisTemplate.boundValueOps(key).get();
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * set类型put
     *
     * @param key
     * @param val
     * @return
     */
    public boolean setSetVal(String key, Set val) {
        try {
            for (Object o : val) {
                redisTemplate.boundSetOps(key).add(o);
            }
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    /**
     * set类型get
     *
     * @param key
     * @return
     */
    public Set getSetVal(String key) {
        try {
            return redisTemplate.boundSetOps(key).members();
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * 删除set中的一项
     *
     * @param key
     * @param opt
     * @return
     */
    public boolean removeSetOpt(String key, Object opt) {
        try {
            redisTemplate.boundSetOps(key).remove(opt);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    public boolean setLeftListVal(String key, List<Object> val) {
        try {
            for (Object o : val) {
                redisTemplate.boundListOps(key).leftPush(o);
            }
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    public boolean setRightListVal(String key, List<Object> val) {
        try {
            for (Object o : val) {
                redisTemplate.boundListOps(key).rightPush(o);
            }
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    public List getListVal(String key, int start, int end) {
        try {
            return redisTemplate.boundListOps(key).range(start, end);
        } catch (Exception e) {
            return null;
        }
    }

    public Object getListVal(String key, int index) {
        try {
            return redisTemplate.boundListOps(key).index(index);
        } catch (Exception e) {
            return null;
        }
    }

    public boolean removeListOpt(String key, int index, Object opt) {
        try {
            redisTemplate.boundListOps(key).remove(index, opt);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    //hash类型的不写了

    /**
     * 删除
     *
     * @param key
     * @return
     */
    public boolean delete(String key) {
        try {
            redisTemplate.delete(key);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}

测试

前提:确保配置文件中配置的mysql和redis都正常

因为使用了swagger  可直接运行 访问http://localhost:8080/swagger-ui.html 测试

也可直接访问对应的url http://localhost:8080/user/all

测试redis

package com.blaze.demo;

import com.alibaba.fastjson.JSON;
import com.blaze.demo.model.UserDomain;
import com.blaze.demo.utils.RedisCommon;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

@RunWith(SpringRunner.class)
@SpringBootTest
public class DemoApplicationTests {

    @Resource
    private RedisTemplate redisTemplate;

    @Test
    public void blaze() {
        RedisCommon redisUtil = new RedisCommon(redisTemplate);
        redisUtil.setObjectValExpries("blaze", "123456", 30, TimeUnit.SECONDS);
        System.out.println(redisUtil.getObjectVal("blaze"));

        UserDomain user = new UserDomain();
        user.setId(1);
        user.setUserId("2333");
        user.setUserName("blazeZzz");
        redisUtil.setObjectValExpries("blazeZzz", JSON.toJSONString(user), 30, TimeUnit.SECONDS);
        System.out.println(redisUtil.getObjectVal("blazeZzz"));
    }
}

结果

以上。

原文地址:https://www.cnblogs.com/blazeZzz/p/10953660.html

时间: 2024-10-05 02:28:14

使用IDEA快速搭建基于Maven的SpringBoot项目的相关文章

基于Maven的SpringBoot项目实现热部署的两种方式

下面我将介绍使用maven构建的SpringBoot项目中实现热部署的两种方式,使得部署变得异常简单,同时两种方式也非常的简单. 热部署 devtools Pom.xml中直接添加依赖即可: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>provided</

利用Jenkins实现jdk11+Maven构建springboot项目

目录 原理图 前期准备 Jdk11安装 Jenkins安装 Maven安装 Jenkins的设置 插件安装 变量配置 搭建项目 1.通用配置 2.源码管理 3.构建触发 4.Maven的构建选项 5.构建后操作 原理图 鉴于网上很多资料一上来直接就开干了,这里我先把这几天所经历的理解化成一张图,以便后续内容更加容易理解. 由上图可以清晰的看到,只要我们再本地的Idea提交代码到GitHub远程仓库,随后Github触发一个web hook(简单来说就是一个Http请求).随后Jenkins接收到

spring boot 快速搭建 基于 Restful 风格的微服务

使用 spring boot 快速搭建 基于  Restful 风格的微服务, 无spring 配置文件,纯java 工程,可以快速发布,调试项目 1.创建一个maven 工程 2. 导入如下配置 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="htt

如何创建一个基于Maven的SmartGWT项目

如何创建一个基于Maven的SmartGWT项目 使用环境 Eclipse的版本为:Luna Service Release 2 (4.4.2)(这个其实不是很重要,你完全可以使用最新版本的Eclipse或者MyEclipse) Maven的版本为:3.1.0 SmartGWT的版本为:6.0p GWT的SDK版本为:2.7 前提准备 你需要安装Maven.如何安装Maven不是文本的内容,你可以参考我的关于Maven的博客. 把SmartGWT的jar包上传到私服服务器. 操作过程 创建GWT

SVN中基于Maven的Web项目更新到本地过程详解

环境 MyEclipse:10.7 Maven:3.1.1 概述 最近在做项目的时候,MyEclipse下载SVN上面基于Maven的Web项目总是出现很多问题,有时候搞了很半天,Maven项目还是出现叉号,最后总结了方法步骤,终于可以将出现的问题解决,在此,将重现从SVN上将基于Maven的Web项目变成本地MyEclipse中项目的过程,问题也在其中进行解决. 问题补充 在使用Myeclipse的部署Web项目的时候,在点击部署按钮的时候,没有任何反应,在此提供两种解决方法,问题如图1所示:

在Ubuntu上快速搭建基于Beego的RESTful API

最近在研究Go,打算基于Go做点Web API,于是经过初步调研,打算用Beego这个框架,然后再结合其中提供的ORM以及Swagger的集成,可以快速搭建一个RESTful API的网站. 下面是具体做法: 1. 在Ubuntu中安装Go 1.8 默认Ubuntu apt-get提供的是Go 1.6,而我们要用最新的Go 1.8需要执行以下操作: 1.1 添加apt-get源并刷新 $ sudo add-apt-repository ppa:gophers/archive $ sudo apt

快速搭建基于 Serverless 的 .NET Core 数据库应用

简介 首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute):函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传.函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费.函数计算更多信息参考 本文将重点介绍如何快速地基于函数计算搭建一个 .NET Core 数据库应用. 开通服务 免费开通函数计算,按量付费,函数计算有很大的免费额度. 快速开始 安装最新版本的 Fun Clo

用Eclipse 搭建一个Maven Spring SpringMVC 项目

1: 先创建一个maven web  项目: 可以参照之前的文章:  用Maven 创建一个 简单的 JavaWeb 项目 创建好之后的目录是这样的; 2: 先配置maven  修改pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="htt

如何在ASP.NET 5上搭建基于TypeScript的Angular2项目

一.前言 就在上月,公司的一个同事建议当前的前端全面改用AngularJs进行开发,而我们采用的就是ASP.NET 5项目,原本我的计划是采用TypeScript直接进行Angular2开发.所以借用这段时间来写下如何在ASP.NET 5下搭建基于TypeScript的Angualr2的项目,下面我们就进入正题. 二.环境配置 如果读者直接按照Angular.io上的方式搭建是无法通过的,所以下面我们的教程基本跟Angular.io上的类似,只是其中的配置会有所不同,并且也会多出一些步骤. 1.