@Component
@Transactional
public class SchedulingTasks {
final Logger logger = Logger.getLogger(SchedulingTasks.class);
@Autowired
PtlCodeDao ptlCodeDao;
}
在spring的
配置文件app.context.xml中想引用这个SchedulingTasks,如果像上面的@Component没有后面跟名字的,
则bean id 默认为头字母小写schedulingTasks.
@Autowired也可以正常用
===========================
@Component("up.portal.util.SchedulingTasks")
@Transactional
public class SchedulingTasks {
final Logger logger = Logger.getLogger(SchedulingTasks.class);
@Autowired
PtlCodeDao ptlCodeDao;
}
在spring的
配置文件app.context.xml中想引用这个SchedulingTasks,如果像上面的@Component后面跟名字
"up.portal.util.SchedulingTasks"的,
则bean id 为@Component的名字"up.portal.util.SchedulingTasks",如:
<!-- 清除过时的认证码 -->
<bean id="rmCodeShedule"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject"
ref="up.portal.util.SchedulingTasks" />
<property name="targetMethod" value="timeRemoveCode" />
<property name="concurrent" value="false" />
</bean>
分享到:
相关推荐
@RunWith(SpringJUnit4ClassRunner.class)//Spring的Junit测试,会在测试开始时,创建Spring的应用上下文 @ContextConfiguration(classes=CDPlayerSpringConfig.class)//表明配置类 public class SpringTest1 { //...
@Configuration@Bean@RestController@Autowired@GetMapping等方法写的,具体实现的功能就是新建几个.yml和.java文件,实现在.yml文件中配置访问路径(输入信息)通过localhost:8080端口实现在网页上输出;...
spring框架的@Resource和@Componentspring框架的@Resource和@Component
spring3.1中文参考文档,南磊翻译,现在有4章,目录如下: 第一部分 Spring framework概述.......................................................................................................................
学生详细信息使用Spring Boot演示@ComponetScan @Component @Bean注释与使用低优先级并执行的@Bean注释相比,通过Spring IOC容器分析@component在使spring Bean对象成为对象时具有更高的优先级,并且在@component...
2.2.2. Naming a component-scanned bean 2.2.3. Setting a base package for component scanning 2.2.4. Annotating beans to be automatically wired 2.2.5. Verifying automatic configuration 2.3. Wiring beans...
nested exception is java.lang.IllegalStateException: Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are ...
6.8.1. 在Spring中使用AspectJ进行domain object的依赖注入 6.8.2. Spring中其他的AspectJ切面 6.8.3. 使用Spring IoC来配置AspectJ的切面 6.8.4. 在Spring应用中使用AspectJ加载时织入(LTW) 6.9. 更多资源 7...
ComponentOne.Studio.for.WinForms.2008 注册机
<description>Spring公共配置文件 <!-- mes 的數據庫 --> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"> <property name="driverClass" value="oracle....
@Component("userService")等价于在spring配置文件中定义一个<bean id="userService"/> @Resource(name="userDAO")将userDA注入进来 写一个拦截器的类 package com.spring.aop; import org.springframework....
主要介绍了spring-boot @Component和@Bean的区别详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
Spring注解@Component、@Repository、@Service、@Controller区别.doc
6.8.1. 在Spring中使用AspectJ进行domain object的依赖注入 6.8.2. Spring中其他的AspectJ切面 6.8.3. 使用Spring IoC来配置AspectJ的切面 6.8.4. 在Spring应用中使用AspectJ加载时织入(LTW) 6.9. 更多资源 7...
Spring Boot Documentation 1. About the Documentation 2. Getting Help 3. First Steps 4. Working with Spring Boot 5. Learning about Spring Boot Features 6. Moving to Production 7. Advanced Topics II. ...
Spring Boot技术知识点:如何深入理解@Component注解
弃用了struts,用spring mvc框架做了几个项目,感觉都不错,而且使用了注解方式,可以省掉一大堆配置文件。本文主要介绍使用注解方式配置的spring mvc,之前写的spring3.0 mvc和rest小例子没有介绍到数据层的内容,...
ComponentOne.Studio.for.Mobile.Devices.2007.v1.5.for.DotNET.Framework.v2.0注册机
网上的东西好大多都不能直接用,自己结合网上资料做了一个Struts2+Spring3+MyBatis3的测试工程,JUnit测试用例和WEB服务。 内涵完整jar包,解压直接可用,包括一个表文件。 Eclipse3.2+Tomcat/5.5+jdk1.5.0_17 - ...