spring 常用配置文件的头文件及配置内容

一、spring

1、applicationContext.xml
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
     https://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context
      https://www.springframework.org/schema/context/spring-context.xsd">

    <!--指定要扫描的包,这个包下的注解就会生效-->
     <context:component-scan base-package="com.xiong"/>
    <!--开启注解支持-->
    <context:annotation-config/>

</beans>
2、资源过滤问题
 <!--设置resources,防止资源导出的问题-->
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

二、Mybatis

1、mybatis-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<!--核心配置文件-->
<configuration>
    <!--引入外部配置文件-->
    <properties resource="db.properties"/>
    <settings>
        <setting name="logImpl" value="STDOUT_LOGGING"/>
    </settings>
    <!--给实体类起别名-->
    <typeAliases>
        <package name="com.xiong.pojo"/>
    </typeAliases>

    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
            <dataSource type="POOLED">
                <property name="driver" value="${driver}"/>
                <property name="url" value="${url}"/>
                <property name="username" value="${username}"/>
                <property name="password" value="${password}"/>
            </dataSource>
        </environment>
    </environments>
    <!--每一个mapper.xml都需要在Mybatis的核心配置文件中注册!-->
    <mappers>
        <mapper class="com.xiong.dao.TeacherMapper"/>
        <mapper class="com.xiong.dao.StudentMapper"/>

    </mappers>
</configuration>
2、xxMapper.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xiong.dao.TeacherMapper">


    <select id="getTeacher" resultMap="TeacherStudent">
        select s.id sid,s.name sname,t.name tname ,t.id tid
        from mybatis.student s,mybatis.teacher t
        where s.tid = t.id and t.id = #{tid};
    </select>
    <resultMap id="TeacherStudent" type="Teacher">
        <result property="id" column="tid"/>
        <result property="name" column="tname"/>
        <!--复杂的属性单独处理  对象:association  集合:collection
        javaType=""
        集合中的泛型类型,我们用ofType获取
        -->
        <collection property="students" ofType="Student">
            <result property="id" column="sid"/>
            <result property="name" column="sname"/>
            <result property="tid" column="tid"/>
        </collection>
    </resultMap>

</mapper>
3、db.properties

driver = com.mysql.jdbc.Driver
#MySQL 8.0.20版本 url中必须添加serverTimezone属性:&serverTimezone=UTC&zeroDateTimeBehavior=CONVERT_TO_NULL
url=jdbc:mysql://localhost:3306/smbms?useSSL=true&useUnicode=true&characterEncoding=utf-8
username=root
password=123456

三、spring-boot

1、application.proprtties
#更改项目端口号
server.port=8080

#关闭thymeleaf缓存
spring.thymeleaf.cache=false

#国际化配置文件的真实的路径
spring.messages.basename=i18n.login

#数据库
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.url=jdbc:mysql://localhost:3306/company?useSSL=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=UTC&zeroDateTimeBehavior=CONVERT_TO_NULL
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

#mybatis
mybatis.type-aliases-package=com.xiong.pojo
mybatis.mapper-locations=classpath:mybatis/mapper/*.xml

#分页
pagehelper.helper-dialect=mysql
pagehelper.reasonable=true
pagehelper.support-methods-arguments=true

四、Spring-mvc

1、springmvc-servlet.xml
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
     https://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context
      https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">


    <!--自动扫描包 指定包下的注解生效,由IOC容器统一管理-->
    <context:component-scan base-package="com.xiong.controller"/>
    <!--JSON乱码问题配置-->
    <mvc:annotation-driven>
        <mvc:message-converters>
            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                <constructor-arg value="UTF-8"/>
            </bean>
            <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="objectMapper">
                    <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean">
                        <property name="failOnEmptyBeans" value="false"/>
                    </bean>
                </property>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>


    <!--视图解析器  :模版引擎  Thymeleaf Freemarker-->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <!--前缀-->
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <!--后缀-->
        <property name="suffix" value=".jsp"/>
    </bean>

</beans>
  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在 Jetson Nano 上使用 Qt Creator 进行 libargus 开发,需要将 libargus 的头文件和库文件添加到您的项目中,以下是具体步骤: 1. 打开 Qt Creator,创建一个新的项目。 2. 在项目的属性中,添加 libargus 的头文件和库文件。具体操作为:打开项目的属性,选择“Build & Run”,在“Build Steps”选项卡中,点击“Add Library”按钮,在弹出的对话框中选择“External Library”,并添加 libargus 的头文件和库文件路径。 - 头文件路径:在 Jetson Nano 上,libargus 的头文件通常位于 `/usr/include/` 目录下。在 Qt Creator 中,您需要将该路径添加到项目的头文件搜索路径中。 - 库文件路径:在 Jetson Nano 上,libargus 的库文件通常位于 `/usr/lib/aarch64-linux-gnu/tegra/` 目录下。在 Qt Creator 中,您需要将该路径添加到项目的库文件搜索路径中。 3. 配置项目的编译选项,以便能够链接 libargus 库。具体操作为:打开项目的属性,选择“Build & Run”,在“Build Settings”选项卡中,添加 libargus 库文件的链接选项。 - 在“Linker Flags”中,添加 `-largus` 选项,以链接 libargus 库文件。 4. 编写代码:在 Qt Creator 中,您可以编写 C++ 代码,调用 libargus 的接口实现图像和视频的采集。具体的接口调用方法可以参考 Nvidia 官方文档或者其他相关的教程。 5. 编译和运行:在 Qt Creator 中,您可以编译和运行您的程序,进行图像和视频的采集和处理。 这样,您就可以在 Jetson Nano 上使用 Qt Creator 进行 libargus 开发了。希望以上步骤能对您有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值