在公司内网环境下用Intellij IDEA创建springboot项目的相关配置

您所在的位置:网站首页 idea怎么配置springboot项目 在公司内网环境下用Intellij IDEA创建springboot项目的相关配置

在公司内网环境下用Intellij IDEA创建springboot项目的相关配置

2023-07-29 02:25| 来源: 网络整理| 查看: 265

刚使用IDEA工具编程,在此记录一下自己创建时遇到的所有问题及解决的过程。

在公司内网环境中需要使用代理才能访问外网的情况下。

一、首先设置setting.xml 加入

 

setting.xml

          optional       true       http       proxyuser

      proxypass

   

      proxy.host.net

   

      80       local.net|some.host.com

   

 

 

 

            mirrorId       repositoryId       Human Readable Name for this Mirror.       http://maven.aliyun.com/nexus/content/groups/public      

二、设置Maven如图

做完以上的步骤后,maven配置完成。下面创建Maven项目。

三、创建Maven项目

之后给项目起名字,没什么注意的地方,一路点击NEXT,创建成功,如图:

 

四、导包(由于属于内网环境,虽然配置了代理,有时也可能会失败,在此我选择手动导包)

1.在src的同级目录下创建Lib文件夹,用于保存手动导入的jar包,将下载好的jar包复制到lib文件夹中,

回到IDEA如图所示。

   

此时jar包还不能使用,需要在导入。请参考http://blog.csdn.net/a153375250/article/details/50851049

导包成功后如图,导入的jar包可以打开了。

此时基础已经完成了。

五、配置spring和Mybatis配置文件

下面是配置文件的详细内容:

 

config.properties driverclass=oracle.jdbc.driver.OracleDriver url=jdbc:oracle:thin:@localhost:1521:SID username=test password=test01 maxActive=100 maxWait=5000 initialSize=10 minIdle=1 mybatis-config.xml   spring-mybatis.xml CyOUserExtendMapper.xml    SELECT * FROM 表名

测试:

test.class import dao.CyOUserExtendMapper; import entity.Cy_O_User_Extend; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.List; public class test{ @Test public void testSpring_My(){ ApplicationContext ac=new ClassPathXmlApplicationContext(new String[] {"spring-mybatis.xml"}); CyOUserExtendMapper coued=(CyOUserExtendMapper) ac.getBean("CyOUserExtendMapper"); List cy_o_user_extendList=coued.selectAll(); for (Cy_O_User_Extend coue: cy_o_user_extendList) { System.out.println(coue); break; } } }


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3