eclipse spring安装_eclipse安装spring tool su
好久不见,今天我想和大家探讨一下关于“eclipse spring安装”的话题。如果你对这个领域还不太熟悉,那么这篇文章就是为你准备的,让我们一起来了解一下吧。
1.eclipse 安装Spring 插件后 Maven怎么不见了
2.eclipse如何搭建springmvc +mybatis
3.spring boot在eclipse中怎么用
4.eclipse 下创建spring starter project
eclipse 安装Spring 插件后 Maven怎么不见了
不见了可能的情况是:
1创建 Spring 之后它帮自动切换了 Perspective (透视图),随之而来的就是菜单和工具样布局变化较大。这是 Eclipse 管理工作台的方法,以 Perspective 为单位保存工作台的设置 ,可以通过右击工具栏 > Customize Perspective (定制透视图) 来调整,在弹出的配置框中勾选需要的东西,它把功能部件按菜单,工具栏等分组了,可以按需要重新勾选需要出来在当前Perspective 的界面元素。
2插件有兼容性故障,导致在刚启动时 Eclipse 就报错了并禁用部分插件,详细情况需要检查 Error Logs 视图 (从 Window 菜单上 > Open View > ... Others,然后查找 Error Logs 视图)。如果插件状态不一致,可以按下面步骤碰碰运气 : 退出 Eclipse 并找到 $Eclipse\Configurations\org.eclipse.osgi 文件夹,清空它。或者卸载后重新安装。
eclipse如何搭建springmvc +mybatis
安装spring framework 4的方法首先,下载spring framework,在baidu中搜索spring tool suite download,进入Download STS网页,这里有基于windows,mac和linux系统的spring框架,下载速度会比较慢。如果你已经安装了eclipse,选择Update Site Archives中的版本,对应上你的eclipse版本进行下载。我的是4.5.2版本,所以我选择第二个版本。
将压缩包放到你喜欢的指定文件夹,然后打开eclipse,选择help菜单中的Install New Software,点击Work with后面的add按钮。在弹出的Add Repository对话框中选择Archive,然后选择你下载好的压缩文件,点击ok就行。
点击ok会出现功能选项框,根据自己的需要进行选择。我这里只选择了有关Spring IDE的选项,全选的话比较费时间且耗内存,然后点击next就行了。
等待检测,点击lnext.
然后会询问你是否接受许可,点击I accept the terms of the lisense agreements,再点击finish就会安装Spring framework.安装后eclipse会提示你是否重启,重启后就生效了。
重启后eclipse会显示welcome页面,看到welcome页面中有Spring IDE就证明安装成功了。也可以在eclipse的window菜单栏中选择preferences选项,在左侧面能够看到spring就证明安装成功,接下来就愉快的编程吧。
spring boot在eclipse中怎么用
SpringMVC+MyBatis+Freemarker 简单框架搭建(一)
一、开发环境:
Eclipse、Tomcat、SVN等请参见如下的帖子,很详细了。
.javass 则注解事务不起作用 TODO 读源码 -->
<context:component-scan base-package="com.weiluo.example.controller">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!-- 因为web-inf目录下面的静态资源文件是不能直接通过目录过去的,所以需要特殊声明-->
<mvc:resources location="/static/" mapping="/static/**" />
<!-- 视图解析器 -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="cache" value="true" />
<property name="prefix" value="" />
<property name="suffix" value=".html" />
<property name="exposeSpringMacroHelpers" value="true" />
<property name="exposeRequestAttributes" value="true" />
<property name="exposeSessionAttributes" value="true" />
<property name="requestContextAttribute" value="rc" />
<property name="contentType" value="text/html;charset=GB2312" />
<property name="order" value="0"/>
</bean>
<!-- 自定义的freemarker标签 -->
<bean id="blockDirective"
class="com.weiluo.example.freemarker.directive.BlockDirective" />
<bean id="extendsDirective"
class="com.weiluo.example.freemarker.directive.ExtendsDirective" />
<bean id="overrideDirective"
class="com.weiluo.example.freemarker.directive.OverrideDirective" />
<bean id="superDirective"
class="com.weiluo.example.freemarker.directive.SuperDirective" />
<!-- freemarker的配置项 -->
<bean id="freemarkerConfig"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath" value="/WEB-INF/views/" />
<property name="freemarkerSettings">
<props>
<prop key="template_update_delay">5</prop>
<prop key="defaultEncoding">GB2312</prop>
<prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
<prop key="date_format">yyyy-MM-dd</prop>
<prop key="time_format">HH:mm:ss</prop>
<prop key="number_format">0.######</prop>
<prop key="whitespace_stripping">true</prop>
</props>
</property>
<property name="freemarkerVariables">
<map>
<entry key="extends" value-ref="extendsDirective"></entry>
<entry key="override" value-ref="overrideDirective"></entry>
<entry key="block" value-ref="blockDirective"></entry>
<entry key="super" value-ref="superDirective"></entry>
</map>
</property>
</bean>
</beans>
4、另外,一些常常变化的信息习惯于存放在application.properties文件里面,如:
#oracle version database setting
database=sqlserver
#jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.driver=net.sourceforge.jtds.jdbc.Driver
#jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:jtds:sqlserver://127.0.0.1:1433;databaseName=SpringMyBatisExample
#jdbc.url=jdbc:mysql://localhost:3306/springmvcdemo
jdbc.username=sa
jdbc.password=sasa
#dbcp settings
dbcp.maxIdle=5
dbcp.maxActive=20
到这里,一个spring mvc的基本框架就已经搭建起来了。
后续再完成数据库mybatis的配置以及freemarker的配置。
eclipse 下创建spring starter project
1.Eclipse中安装STS插件:
Help -> Eclipse Marketplace…
Search或选择“Popular”标签,选择Spring Tool Suite (STS) for Eclipse插件,安装:
2.New -> Project…
找到Spring目录,选择Spring Starter Project,Next
3、填写跟项目相关的各种信息,然后Next
4.选择需要的Dependency,然后Next:
5.Next,然后Finsh,新项目就创建好了,各个目录如下:
6.右键MySpringBootApplication中的main方法,Run As -> Spring Boot App,项目就可以启动了。
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MySpringBootApplication {
public static void main(String[] args) {
SpringApplication.run(MySpringBootApplication.class, args);
}
}
12345678910111213
由于选择了web dependency默认启动一个Tomcat,8080端口监听
7.把application.properties改名为application.yml(个人喜欢),修改Tomcat的启动端口:
server:
port: 8081
一.在eclipse下安装 spring tool suite插件:
1.help→eclipseMaketplace..→搜索sts.
2.安装插件,安装不成功的话,降低eclipse版本(2018-12,亲测能有)
?1 选择spring starter project 进行项目的创建,并点击next到下一步
2 修改项目名称name 和 spring boot的版本,其他项都可以选择默认
这里可以选择next,也可以选择finish。如果选择next按钮,则会看到步骤3的界面;如果选择finish按钮,则直接跳到步骤4界面。
3 这里可以选择工作空间等,我们都选择默认空间即可,点击finish到下一步
4 这里我们会得到一个spring boot 的项目的简单结构
这时,eclipse一般会自动的进行项目的构建,加载支撑jar包等,得到步骤6的结果;如果eclipse未自动构建项目,则需要手动进行项目构建,参照步骤5进行操作。
5 点击项目名称,右键 选择 Maven ,选择 Update Project... ,勾选 Force Update of Snapshots/Releases项, 并点击OK按钮。
然后,项目会进入到更新的过程中,期间可以看到类似如下的更新进度条
6 待项目更新完成后,我们可以看到一个完整的spring boot 项目
好了,今天关于eclipse spring安装就到这里了。希望大家对eclipse spring安装有更深入的了解,同时也希望这个话题eclipse spring安装的解答可以帮助到大家。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。