springboot 入门 1

2017-10-14  本文已影响0人  闹闹不要闹

最近在学习springboot, 故写下这些文章来记录我的学习历程,本人菜鸟一只,如果有错误的地方,希望大家积极指正,

这篇文章主要是讲 springboot 如何继承jersey, 来时先mvc思想,当然 springboot 是支持controller 来写实现接口的设计,使用@RequestMapping, @RestController 这些注解

但是我还是觉得jersey 看起来更加优雅,然后易于维护和阅读

首先需要搭建一个spingboot项目,  项目地址

```

subprojects {

applyplugin:'java'

applyplugin:'maven'

group'com.smaug'

version'1.0-SNAPSHOT'

targetCompatibility =1.8

sourceCompatibility =1.8

[compileJava, compileTestJava].each() {

it.options.encoding ="UTF-8"

}

repositories {

mavenLocal()

maven {

url'http://maven.aliyun.com/nexus/content/groups/public/'

}

mavenCentral()

}

task sourcesJar(type: Jar,dependsOn:classes) {

classifier='sources'

from sourceSets.main.allSource

}

artifacts {

archives sourcesJar

}

configurations.all {

resolutionStrategy.cacheChangingModulesFor1,'minutes'

}

dependencies {

compile('org.springframework.boot:spring-boot-starter:1.5.7.RELEASE') {

exclude(module:'spring-boot-starter-logging')

}

compile('org.slf4j:slf4j-api:1.7.25')

compile('org.apache.logging.log4j:log4j-slf4j-impl:2.8.2')

compile('org.apache.logging.log4j:log4j-core:2.8.2')

compile('org.apache.logging.log4j:log4j-web:2.8.2')

compile'com.alibaba:dubbo:2.8.5-SNAPSHOT'

compile"org.springframework.boot:spring-boot-starter-jersey:1.5.1.RELEASE"

compile"com.baidu.disconf:disconf-client:2.6.36"

compile'mysql:mysql-connector-java:6.0.6'

compile'org.mybatis.generator:mybatis-generator-core:1.3.5'

compile"com.101tec:zkclient:0.8.1"

compile'org.apache.zookeeper:zookeeper:3.4.8'

compile'org.projectlombok:lombok:1.16.8'

compile'org.springframework:spring-core:4.2.5.RELEASE'

compile'org.springframework:spring-context-support:4.2.5.RELEASE'

compile'org.springframework:spring-beans:4.2.5.RELEASE'

compile'org.springframework:spring-oxm:4.2.5.RELEASE'

compile"org.springframework:spring-jms:4.2.5.RELEASE"

compile'org.springframework.retry:spring-retry:1.1.2.RELEASE'

compile'org.springframework:spring-context:4.2.5.RELEASE'

compile'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.8.9'

compile'com.alibaba:fastjson:1.2.38'

//testCompile "junit:junit:4.12"

testCompile'org.springframework:spring-test:5.0.0.RELEASE'

testCompile'org.springframework.boot:spring-boot-starter-test:1.5.7.RELEASE'

}

}

```

上一篇 下一篇

猜你喜欢

热点阅读