社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
server:
#指定端口
port: 8880
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class HelloController {
@ResponseBody
@RequestMapping(value = "/hello", method = {RequestMethod.GET})
public String hello(){
return "hello";
}
}
. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _
( ( )___ | '_ | '_| | '_ / _` |
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.5.RELEASE)
2019-05-18 22:30:20.205 INFO 33556 --- [ main] org.virtue.FastSpringbootApplication : Starting FastSpringbootApplication on 13XK9CRTRMLYN7L with PID 33556 (F:projectfast_springbootbuildclassesjavamain started by Administrator in F:projectfast_springboot)
2019-05-18 22:30:20.207 INFO 33556 --- [ main] org.virtue.FastSpringbootApplication : No active profile set, falling back to default profiles: default
2019-05-18 22:30:20.740 INFO 33556 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8880 (http)
2019-05-18 22:30:20.754 INFO 33556 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-05-18 22:30:20.755 INFO 33556 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.19]
2019-05-18 22:30:20.811 INFO 33556 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-05-18 22:30:20.812 INFO 33556 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 583 ms
2019-05-18 22:30:20.924 INFO 33556 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-05-18 22:30:21.030 INFO 33556 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8880 (http) with context path ''
2019-05-18 22:30:21.032 INFO 33556 --- [ main] org.virtue.FastSpringbootApplication : Started FastSpringbootApplication in 1.061 seconds (JVM running for 1.81)
2019-05-18 22:31:09.879 INFO 33556 --- [nio-8880-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-05-18 22:31:09.880 INFO 33556 --- [nio-8880-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-05-18 22:31:09.884 INFO 33556 --- [nio-8880-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 4 ms
使用postman发送请求:http://127.0.0.1:8880/hello,响应如下:
至此,项目搭建完成!
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!