当前位置: 首页 > news >正文

做汽车网站怎么挣钱wordpress phone主题

做汽车网站怎么挣钱,wordpress phone主题,怎样做一个企业的网站建站,河南省建筑一体化平台对于Spring Boot 1.1.0.RC1#xff0c;添加了自动配置和Spring Social的启动程序pom#xff0c;这意味着我不必为pom添加一百个依赖关系#xff0c;并且将为我处理许多毫无意义的Spring配置。 让我们来看一个例子。 我将实现一个两页的Web应用程序。 一个将显示给定用户的T… 对于Spring Boot 1.1.0.RC1添加了自动配置和Spring Social的启动程序pom这意味着我不必为pom添加一百个依赖关系并且将为我处理许多毫无意义的Spring配置。 让我们来看一个例子。 我将实现一个两页的Web应用程序。 一个将显示给定用户的Twitter时间轴另一个将显示用户的个人资料信息。 这是我的pom project xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance xmlnshttp://maven.apache.org/POM/4.0.0 xsi:schemalocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelversion4.0.0/modelversiongroupidnr.co.caught/groupidartifactidBootTwitterJoy/artifactidversion1.0-SNAPSHOT/versionpackagingwar/packaging!-- Inherit defaults from Spring Boot --parentgroupidorg.springframework.boot/groupidartifactidspring-boot-starter-parent/artifactidversion1.1.0.RC1/version/parentdependenciesdependencygroupidorg.springframework.boot/groupidartifactidspring-boot-starter-social-twitter/artifactid/dependency!-- Both are needed for jsp support--dependencygroupidorg.apache.tomcat.embed/groupidartifactidtomcat-embed-jasper/artifactid/dependencydependencygroupidjavax.servlet/groupidartifactidjstl/artifactid/dependency/dependencies!-- Needed for fat jar --buildpluginsplugingroupidorg.springframework.boot/groupidartifactidspring-boot-maven-plugin/artifactid/plugin/plugins/build!-- Add Spring repositories --!-- (you dont need this if you are using a .RELEASE version) --repositoriesrepositoryidspring-snapshots/idurlhttp://repo.spring.io/snapshot/urlsnapshotsenabledtrue/enabled/snapshots/repositoryrepositoryidspring-milestones/idurlhttp://repo.spring.io/milestone/url/repository/repositoriespluginrepositoriespluginrepositoryidspring-snapshots/idurlhttp://repo.spring.io/snapshot/url/pluginrepositorypluginrepositoryidspring-milestones/idurlhttp://repo.spring.io/milestone/url/pluginrepository/pluginrepositories/project 如您所见我具有starter-social-twitter依赖关系该依赖关系为我提供了Spring Social和Web功能。 我将为我的jsp页面添加jasper和jstl。 由于具有里程碑意义的存储库因此我的存储库部分已足够填充。 现在我们将添加我们的服务来执行Twitter方法调用和一个用于处理请求的控制器。 我们的控制器简单明了 Controller public class TwitterController {Autowiredprivate TwitterService twitterService;RequestMapping(value /timeline/{twitterUser})public String getUserTimeline(PathVariable String twitterUser, Model model) {model.addAttribute(tweets, twitterService.getUserTimeline(twitterUser));model.addAttribute(user, twitterUser);return timeline;}RequestMapping(value /profile/{twitterUser})public String getUserProfile(PathVariable String twitterUser, Model model) {model.addAttribute(userProfile, twitterService.getUserProfile(twitterUser));return profile;} } 如果请求带有“ / timeline / username”我们的控制器将获取用户时间轴如果带有“ / profile / username”它将从TwitterService获取用户配置文件。 这是我们的TwitterService Service public class TwitterService {Autowiredprivate Twitter twitter;public List Tweet getUserTimeline(String twitterUser) {TimelineOperations timelineOps twitter.timelineOperations();List tweets timelineOps.getUserTimeline( twitterUser);return tweets;}public TwitterProfile getUserProfile(String twitterUser) {UserOperations userOperations twitter.userOperations();TwitterProfile userProfile userOperations.getUserProfile(twitterUser);return userProfile;} } 由于Spring Boot的自动配置我们将创建一个Twitter对象。 我们只需要在我们的应用程序属性中提供一个应用程序ID和应用程序秘密密钥又名“消费者密钥”和“消费者秘密”Boot将完成其余的工作。 我引用了Spring javadoc中的Twitter对象说明 “ TwitterTemplate的此实例仅限于执行需要客户端授权的操作。 例如您可以使用它来搜索Twitter但不能使用它来发布状态更新。 此处提供的客户端凭据用于通过OAuth 2客户端凭据授予获取客户端访问令牌。 如果您尝试进行状态更新则会得到“ org.springframework.social.MissingAuthorizationException操作需要授权但API绑定是未经授权创建的”。 对于进一步的Twitter功能我们还需要提供访问令牌和访问令牌秘密密钥但据我所知自动配置尚无法解决这些情况。 我的JSP profile.jsp % page contentTypetext/html;charsetUTF-8 languagejava % html headtitle/title /head body img src${userProfile.profileImageUrl}/ Screen name: ${userProfile.screenName} Name: ${userProfile.name} Description: ${userProfile.description} Location: ${userProfile.location} Followers: ${userProfile.followersCount} /body /html 如您所见概要文件采用了我们控制器提供的userProfile并显示了基本概要文件属性。 timeline.jsp % taglib prefixc urihttp://java.sun.com/jsp/jstl/core % % page contentTypetext/html;charsetUTF-8 languagejava % html headtitleTime Line for c:out value${twitterUser} / TimeLine/title /head body ulc:forEach items${tweets} vartweetli${tweet.text}at c:out value${tweet.createdAt}//li/c:forEach /ul /body /html 显示推文及其文本和创建日期。 我的application.properties内容 # Config for JSPs spring.view.prefix: /WEB-INF/jsp/ spring.view.suffix: .jsp# SPRING SOCIAL TWITTER (TwitterAutoConfiguration) spring.social.twitter.appId someAppId spring.social.twitter.appSecret someSecretId spring.view属性用于jsp处理。 spring.social.twitter属性可以从http://dev.twitter.com获得 。 只需使用您的Twitter帐户登录那里创建您的应用并获取api密钥。 结果如下 您可以在github上检查代码。 翻译自: https://www.javacodegeeks.com/2014/06/spring-social-example-on-spring-boot-or-how-i-stopped-worrying-and-loved-autoconfiguration.html
http://www.sadfv.cn/news/126394/

相关文章:

  • 基层建设期刊在哪个网站上检索好的建筑设计网站推荐
  • 宁夏找人做网站多少钱广告网站留电话整人
  • 湖北省建设厅官方网站电话成品人和精品人的区别在哪
  • 推广做网站联系方式关于网站建设电话销售的话术
  • 网站建设网页如何做好外贸网站建设
  • 做电商网站前端的技术选型是广安做网站
  • 网站建设培训中心青岛手机端网络推广培训
  • 郑州网站搭建扁平化网站设计方案
  • 制作网站用什么软件好手机网站的必要性
  • 漂亮的数据型网站宁波建网站推荐
  • 莱芜住房和城乡建设部网站网站被采集
  • 仿制型模板网站服装定制流程
  • 微小店适合卖做分类网站吗公司公众网站微信平台建设方案
  • asp.net 网站管理工具 安全深圳物流公司查询大全
  • 58同城网站建设思路免费自助网站
  • 溧阳建设局网站6江苏盐城网络科技有限公司
  • 深圳专门网站建设金华网站建设外包
  • 网上网站代码可以下载吗万维网网站注册
  • 珠海网站制作品牌策划网站推广教学
  • 正在建设的网站可以随时进入吗织梦网站自适应怎么做
  • 住房公积金网站怎么做减员建筑人才网官方网站中国建筑科学院有限公司认证中心
  • 江门企业做网站解决wordpress慢
  • 基于开源框架的网站开发如何 建设一个网站
  • 可以做家装设计的网站河北省建设工程安全生产监督管理网站
  • 自己做视频直播网站有哪些网站可以做微商
  • 工信部 网站备案江西建设质量安全监督网站
  • 顺企网网站建设北京网站推广排名外包
  • 做网站如何将一张图片直接变体西安网站建设最新案例
  • 耐思尼克的建站宝盒财务公司承兑汇票
  • 网站每天一条推送怎么做的东莞seo关键词排名优化推广