language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/mail/javamail/ConfigurableMimeFileTypeMap.java | @@ -101,6 +101,7 @@ public void setMappings(String[] mappings) {
/**
* Creates the final merged mapping set.
*/
+ @Override
public void afterPropertiesSet() {
getFileTypeMap();
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java | @@ -292,10 +292,12 @@ public FileTypeMap getDefaultFileTypeMap() {
// Implementation of MailSender
//---------------------------------------------------------------------
+ @Override
public void send(SimpleMailMessage simpleMessage) throws MailException {
send(new SimpleMailMessage[] { simpleMessage });
}
+ @Override
public void send(SimpleMailMessage[] simpleMessages) throws MailException {
List<MimeMessage> mimeMessages = new ArrayList<MimeMessage>(simpleMessages.length);
for (SimpleMailMessage simpleMessage : simpleMessages) {
@@ -319,10 +321,12 @@ public void send(SimpleMailMessage[] simpleMessages) throws MailException {
* @see #setDefaultEncoding
* @see #setDefaultFileTypeMap
*/
+ @Override
public MimeMessage createMimeMessage() {
return new SmartMimeMessage(getSession(), getDefaultEncoding(), getDefaultFileTypeMap());
}
+ @Override
public MimeMessage createMimeMessage(InputStream contentStream) throws MailException {
try {
return new MimeMessage(getSession(), contentStream);
@@ -332,18 +336,22 @@ public MimeMessage createMimeMessage(InputStream contentStream) throws MailExcep
}
}
+ @Override
public void send(MimeMessage mimeMessage) throws MailException {
send(new MimeMessage[] {mimeMessage});
}
+ @Override
public void send(MimeMessage[] mimeMessages) throws MailException {
doSend(mimeMessages, null);
}
+ @Override
public void send(MimeMessagePreparator mimeMessagePreparator) throws MailException {
send(new MimeMessagePreparator[] { mimeMessagePreparator });
}
+ @Override
public void send(MimeMessagePreparator[] mimeMessagePreparators) throws MailException {
try {
List<MimeMessage> mimeMessages = new ArrayList<MimeMessage>(mimeMessagePreparators.length); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMailMessage.java | @@ -73,6 +73,7 @@ public final MimeMessage getMimeMessage() {
}
+ @Override
public void setFrom(String from) throws MailParseException {
try {
this.helper.setFrom(from);
@@ -82,6 +83,7 @@ public void setFrom(String from) throws MailParseException {
}
}
+ @Override
public void setReplyTo(String replyTo) throws MailParseException {
try {
this.helper.setReplyTo(replyTo);
@@ -91,6 +93,7 @@ public void setReplyTo(String replyTo) throws MailParseException {
}
}
+ @Override
public void setTo(String to) throws MailParseException {
try {
this.helper.setTo(to);
@@ -100,6 +103,7 @@ public void setTo(String to) throws MailParseException {
}
}
+ @Override
public void setTo(String[] to) throws MailParseException {
try {
this.helper.setTo(to);
@@ -109,6 +113,7 @@ public void setTo(String[] to) throws MailParseException {
}
}
+ @Override
public void setCc(String cc) throws MailParseException {
try {
this.helper.setCc(cc);
@@ -118,6 +123,7 @@ public void setCc(String cc) throws MailParseException {
}
}
+ @Override
public void setCc(String[] cc) throws MailParseException {
try {
this.helper.setCc(cc);
@@ -127,6 +133,7 @@ public void setCc(String[] cc) throws MailParseException {
}
}
+ @Override
public void setBcc(String bcc) throws MailParseException {
try {
this.helper.setBcc(bcc);
@@ -136,6 +143,7 @@ public void setBcc(String bcc) throws MailParseException {
}
}
+ @Override
public void setBcc(String[] bcc) throws MailParseException {
try {
this.helper.setBcc(bcc);
@@ -145,6 +153,7 @@ public void setBcc(String[] bcc) throws MailParseException {
}
}
+ @Override
public void setSentDate(Date sentDate) throws MailParseException {
try {
this.helper.setSentDate(sentDate);
@@ -154,6 +163,7 @@ public void setSentDate(Date sentDate) throws MailParseException {
}
}
+ @Override
public void setSubject(String subject) throws MailParseException {
try {
this.helper.setSubject(subject);
@@ -163,6 +173,7 @@ public void setSubject(String subject) throws MailParseException {
}
}
+ @Override
public void setText(String text) throws MailParseException {
try {
this.helper.setText(text); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java | @@ -1088,15 +1088,19 @@ protected DataSource createDataSource(
final InputStreamSource inputStreamSource, final String contentType, final String name) {
return new DataSource() {
+ @Override
public InputStream getInputStream() throws IOException {
return inputStreamSource.getInputStream();
}
+ @Override
public OutputStream getOutputStream() {
throw new UnsupportedOperationException("Read-only javax.activation.DataSource");
}
+ @Override
public String getContentType() {
return contentType;
}
+ @Override
public String getName() {
return name;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingTimerListener.java | @@ -47,6 +47,7 @@ public DelegatingTimerListener(Runnable runnable) {
/**
* Delegates execution to the underlying Runnable.
*/
+ @Override
public void timerExpired(Timer timer) {
this.runnable.run();
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/commonj/DelegatingWork.java | @@ -57,6 +57,7 @@ public final Runnable getDelegate() {
/**
* Delegates execution to the underlying Runnable.
*/
+ @Override
public void run() {
this.delegate.run();
}
@@ -66,6 +67,7 @@ public void run() {
* {@link org.springframework.scheduling.SchedulingAwareRunnable#isLongLived()},
* if available.
*/
+ @Override
public boolean isDaemon() {
return (this.delegate instanceof SchedulingAwareRunnable &&
((SchedulingAwareRunnable) this.delegate).isLongLived());
@@ -75,6 +77,7 @@ public boolean isDaemon() {
* This implementation is empty, since we expect the Runnable
* to terminate based on some specific shutdown signal.
*/
+ @Override
public void release() {
}
| true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerAccessor.java | @@ -95,6 +95,7 @@ public void setShared(boolean shared) {
}
+ @Override
public void afterPropertiesSet() throws NamingException {
if (this.timerManager == null) {
if (this.timerManagerName == null) {
@@ -117,6 +118,7 @@ protected final TimerManager getTimerManager() {
* Resumes the underlying TimerManager (if not shared).
* @see commonj.timers.TimerManager#resume()
*/
+ @Override
public void start() {
if (!this.shared) {
this.timerManager.resume();
@@ -127,6 +129,7 @@ public void start() {
* Suspends the underlying TimerManager (if not shared).
* @see commonj.timers.TimerManager#suspend()
*/
+ @Override
public void stop() {
if (!this.shared) {
this.timerManager.suspend();
@@ -139,6 +142,7 @@ public void stop() {
* @see commonj.timers.TimerManager#isSuspending()
* @see commonj.timers.TimerManager#isStopping()
*/
+ @Override
public boolean isRunning() {
return (!this.timerManager.isSuspending() && !this.timerManager.isStopping());
}
@@ -152,6 +156,7 @@ public boolean isRunning() {
* Stops the underlying TimerManager (if not shared).
* @see commonj.timers.TimerManager#stop()
*/
+ @Override
public void destroy() {
// Stop the entire TimerManager, if necessary.
if (!this.shared) { | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerFactoryBean.java | @@ -76,6 +76,7 @@ public void setScheduledTimerListeners(ScheduledTimerListener[] scheduledTimerLi
// Implementation of InitializingBean interface
//---------------------------------------------------------------------
+ @Override
public void afterPropertiesSet() throws NamingException {
super.afterPropertiesSet();
if (this.scheduledTimerListeners != null) {
@@ -105,15 +106,18 @@ public void afterPropertiesSet() throws NamingException {
// Implementation of FactoryBean interface
//---------------------------------------------------------------------
+ @Override
public TimerManager getObject() {
return getTimerManager();
}
+ @Override
public Class<? extends TimerManager> getObjectType() {
TimerManager timerManager = getTimerManager();
return (timerManager != null ? timerManager.getClass() : TimerManager.class);
}
+ @Override
public boolean isSingleton() {
return true;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/commonj/TimerManagerTaskScheduler.java | @@ -52,38 +52,44 @@ public void setErrorHandler(ErrorHandler errorHandler) {
}
+ @Override
public ScheduledFuture schedule(Runnable task, Trigger trigger) {
return new ReschedulingTimerListener(errorHandlingTask(task, true), trigger).schedule();
}
+ @Override
public ScheduledFuture schedule(Runnable task, Date startTime) {
TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, false));
Timer timer = getTimerManager().schedule(futureTask, startTime);
futureTask.setTimer(timer);
return futureTask;
}
+ @Override
public ScheduledFuture scheduleAtFixedRate(Runnable task, Date startTime, long period) {
TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, true));
Timer timer = getTimerManager().scheduleAtFixedRate(futureTask, startTime, period);
futureTask.setTimer(timer);
return futureTask;
}
+ @Override
public ScheduledFuture scheduleAtFixedRate(Runnable task, long period) {
TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, true));
Timer timer = getTimerManager().scheduleAtFixedRate(futureTask, 0, period);
futureTask.setTimer(timer);
return futureTask;
}
+ @Override
public ScheduledFuture scheduleWithFixedDelay(Runnable task, Date startTime, long delay) {
TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, true));
Timer timer = getTimerManager().schedule(futureTask, startTime, delay);
futureTask.setTimer(timer);
return futureTask;
}
+ @Override
public ScheduledFuture scheduleWithFixedDelay(Runnable task, long delay) {
TimerScheduledFuture futureTask = new TimerScheduledFuture(errorHandlingTask(task, true));
Timer timer = getTimerManager().schedule(futureTask, 0, delay);
@@ -113,6 +119,7 @@ public void setTimer(Timer timer) {
this.timer = timer;
}
+ @Override
public void timerExpired(Timer timer) {
runAndReset();
}
@@ -125,10 +132,12 @@ public boolean cancel(boolean mayInterruptIfRunning) {
return result;
}
+ @Override
public long getDelay(TimeUnit unit) {
return unit.convert(System.currentTimeMillis() - this.timer.getScheduledExecutionTime(), TimeUnit.MILLISECONDS);
}
+ @Override
public int compareTo(Delayed other) {
if (this == other) {
return 0; | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/commonj/WorkManagerTaskExecutor.java | @@ -109,6 +109,7 @@ public void setWorkListener(WorkListener workListener) {
this.workListener = workListener;
}
+ @Override
public void afterPropertiesSet() throws NamingException {
if (this.workManager == null) {
if (this.workManagerName == null) {
@@ -123,6 +124,7 @@ public void afterPropertiesSet() throws NamingException {
// Implementation of the Spring SchedulingTaskExecutor interface
//-------------------------------------------------------------------------
+ @Override
public void execute(Runnable task) {
Assert.state(this.workManager != null, "No WorkManager specified");
Work work = new DelegatingWork(task);
@@ -142,16 +144,19 @@ public void execute(Runnable task) {
}
}
+ @Override
public void execute(Runnable task, long startTimeout) {
execute(task);
}
+ @Override
public Future<?> submit(Runnable task) {
FutureTask<Object> future = new FutureTask<Object>(task, null);
execute(future);
return future;
}
+ @Override
public <T> Future<T> submit(Callable<T> task) {
FutureTask<T> future = new FutureTask<T>(task);
execute(future);
@@ -161,6 +166,7 @@ public <T> Future<T> submit(Callable<T> task) {
/**
* This task executor prefers short-lived work units.
*/
+ @Override
public boolean prefersShortLivedTasks() {
return true;
}
@@ -170,24 +176,28 @@ public boolean prefersShortLivedTasks() {
// Implementation of the CommonJ WorkManager interface
//-------------------------------------------------------------------------
+ @Override
public WorkItem schedule(Work work)
throws WorkException, IllegalArgumentException {
return this.workManager.schedule(work);
}
+ @Override
public WorkItem schedule(Work work, WorkListener workListener)
throws WorkException, IllegalArgumentException {
return this.workManager.schedule(work, workListener);
}
+ @Override
public boolean waitForAll(Collection workItems, long timeout)
throws InterruptedException, IllegalArgumentException {
return this.workManager.waitForAll(workItems, timeout);
}
+ @Override
public Collection waitForAny(Collection workItems, long timeout)
throws InterruptedException, IllegalArgumentException {
| true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/AdaptableJobFactory.java | @@ -50,6 +50,7 @@ public Job newJob(TriggerFiredBundle bundle, Scheduler scheduler) throws Schedul
/**
* Quartz 1.x version of newJob: contains actual implementation code.
*/
+ @Override
public Job newJob(TriggerFiredBundle bundle) throws SchedulerException {
try {
Object jobObject = createJobInstance(bundle); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerBean.java | @@ -139,15 +139,18 @@ public void setJobDetail(JobDetail jobDetail) {
this.jobDetail = jobDetail;
}
+ @Override
public JobDetail getJobDetail() {
return this.jobDetail;
}
+ @Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
+ @Override
public void afterPropertiesSet() throws Exception {
if (this.startDelay > 0) {
setStartTime(new Date(System.currentTimeMillis() + this.startDelay)); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java | @@ -191,11 +191,13 @@ public void setMisfireInstructionName(String constantName) {
this.misfireInstruction = constants.asNumber(constantName).intValue();
}
+ @Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
+ @Override
public void afterPropertiesSet() {
if (this.name == null) {
this.name = this.beanName;
@@ -265,14 +267,17 @@ else if (this.startTime == null) {
}
+ @Override
public CronTrigger getObject() {
return this.cronTrigger;
}
+ @Override
public Class<?> getObjectType() {
return CronTrigger.class;
}
+ @Override
public boolean isSingleton() {
return true;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/DelegatingJob.java | @@ -60,6 +60,7 @@ public final Runnable getDelegate() {
/**
* Delegates execution to the underlying Runnable.
*/
+ @Override
public void execute(JobExecutionContext context) throws JobExecutionException {
this.delegate.run();
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailBean.java | @@ -115,10 +115,12 @@ public void setJobListenerNames(String[] names) {
}
}
+ @Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
+ @Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@@ -144,6 +146,7 @@ public void setApplicationContextJobDataKey(String applicationContextJobDataKey)
}
+ @Override
public void afterPropertiesSet() {
if (getName() == null) {
setName(this.beanName); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/JobDetailFactoryBean.java | @@ -139,10 +139,12 @@ public void setDescription(String description) {
this.description = description;
}
+ @Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
+ @Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@@ -168,6 +170,7 @@ public void setApplicationContextJobDataKey(String applicationContextJobDataKey)
}
+ @Override
public void afterPropertiesSet() {
if (this.name == null) {
this.name = this.beanName;
@@ -215,14 +218,17 @@ public void afterPropertiesSet() {
}
+ @Override
public JobDetail getObject() {
return this.jobDetail;
}
+ @Override
public Class<?> getObjectType() {
return JobDetail.class;
}
+ @Override
public boolean isSingleton() {
return true;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java | @@ -101,10 +101,12 @@ public void initialize(ClassLoadHelper loadHelper, SchedulerSignaler signaler)
DBConnectionManager.getInstance().addConnectionProvider(
TX_DATA_SOURCE_PREFIX + getInstanceName(),
new ConnectionProvider() {
+ @Override
public Connection getConnection() throws SQLException {
// Return a transactional Connection, if any.
return DataSourceUtils.doGetConnection(dataSource);
}
+ @Override
public void shutdown() {
// Do nothing - a Spring-managed DataSource has its own lifecycle.
}
@@ -124,10 +126,12 @@ public void shutdown() {
DBConnectionManager.getInstance().addConnectionProvider(
NON_TX_DATA_SOURCE_PREFIX + getInstanceName(),
new ConnectionProvider() {
+ @Override
public Connection getConnection() throws SQLException {
// Always return a non-transactional Connection.
return nonTxDataSourceToUse.getConnection();
}
+ @Override
public void shutdown() {
// Do nothing - a Spring-managed DataSource has its own lifecycle.
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalTaskExecutorThreadPool.java | @@ -40,13 +40,16 @@ public class LocalTaskExecutorThreadPool implements ThreadPool {
private Executor taskExecutor;
+ @Override
public void setInstanceId(String schedInstId) {
}
+ @Override
public void setInstanceName(String schedName) {
}
+ @Override
public void initialize() throws SchedulerConfigException {
// Absolutely needs thread-bound TaskExecutor to initialize.
this.taskExecutor = SchedulerFactoryBean.getConfigTimeTaskExecutor();
@@ -57,14 +60,17 @@ public void initialize() throws SchedulerConfigException {
}
}
+ @Override
public void shutdown(boolean waitForJobsToComplete) {
}
+ @Override
public int getPoolSize() {
return -1;
}
+ @Override
public boolean runInThread(Runnable runnable) {
if (runnable == null) {
return false;
@@ -79,6 +85,7 @@ public boolean runInThread(Runnable runnable) {
}
}
+ @Override
public int blockForAvailableThreads() {
// The present implementation always returns 1, making Quartz (1.6)
// always schedule any tasks that it feels like scheduling. | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/MethodInvokingJobDetailFactoryBean.java | @@ -176,14 +176,17 @@ public void setJobListenerNames(String[] names) {
this.jobListenerNames = names;
}
+ @Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
+ @Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}
+ @Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
@@ -194,6 +197,7 @@ protected Class resolveClassName(String className) throws ClassNotFoundException
}
+ @Override
public void afterPropertiesSet() throws ClassNotFoundException, NoSuchMethodException {
prepare();
@@ -272,14 +276,17 @@ public Object getTargetObject() {
}
+ @Override
public JobDetail getObject() {
return this.jobDetail;
}
+ @Override
public Class<? extends JobDetail> getObjectType() {
return (this.jobDetail != null ? this.jobDetail.getClass() : JobDetail.class);
}
+ @Override
public boolean isSingleton() {
return true;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/QuartzJobBean.java | @@ -92,6 +92,7 @@ public abstract class QuartzJobBean implements Job {
* values, and delegates to {@code executeInternal} afterwards.
* @see #executeInternal
*/
+ @Override
public final void execute(JobExecutionContext context) throws JobExecutionException {
try {
// Reflectively adapting to differences between Quartz 1.x and Quartz 2.0... | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/ResourceLoaderClassLoadHelper.java | @@ -62,6 +62,7 @@ public ResourceLoaderClassLoadHelper(ResourceLoader resourceLoader) {
}
+ @Override
public void initialize() {
if (this.resourceLoader == null) {
this.resourceLoader = SchedulerFactoryBean.getConfigTimeResourceLoader();
@@ -71,6 +72,7 @@ public void initialize() {
}
}
+ @Override
public Class loadClass(String name) throws ClassNotFoundException {
return this.resourceLoader.getClassLoader().loadClass(name);
}
@@ -80,6 +82,7 @@ public <T> Class<? extends T> loadClass(String name, Class<T> clazz) throws Clas
return loadClass(name);
}
+ @Override
public URL getResource(String name) {
Resource resource = this.resourceLoader.getResource(name);
try {
@@ -94,6 +97,7 @@ public URL getResource(String name) {
}
}
+ @Override
public InputStream getResourceAsStream(String name) {
Resource resource = this.resourceLoader.getResource(name);
try {
@@ -108,6 +112,7 @@ public InputStream getResourceAsStream(String name) {
}
}
+ @Override
public ClassLoader getClassLoader() {
return this.resourceLoader.getClassLoader();
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessor.java | @@ -239,6 +239,7 @@ public void setTransactionManager(PlatformTransactionManager transactionManager)
this.transactionManager = transactionManager;
}
+ @Override
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerAccessorBean.java | @@ -73,11 +73,13 @@ public Scheduler getScheduler() {
return this.scheduler;
}
+ @Override
public void setBeanFactory(BeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
+ @Override
public void afterPropertiesSet() throws SchedulerException {
if (this.scheduler == null) {
if (this.schedulerName != null) { | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java | @@ -369,6 +369,7 @@ public void setAutoStartup(boolean autoStartup) {
* the scheduler will start after the context is refreshed and after the
* start delay, if any.
*/
+ @Override
public boolean isAutoStartup() {
return this.autoStartup;
}
@@ -387,6 +388,7 @@ public void setPhase(int phase) {
/**
* Return the phase in which this scheduler will be started and stopped.
*/
+ @Override
public int getPhase() {
return this.phase;
}
@@ -426,12 +428,14 @@ public void setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnSh
}
+ @Override
public void setBeanName(String name) {
if (this.schedulerName == null) {
this.schedulerName = name;
}
}
+ @Override
public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@@ -441,6 +445,7 @@ public void setApplicationContext(ApplicationContext applicationContext) {
// Implementation of InitializingBean interface
//---------------------------------------------------------------------
+ @Override
public void afterPropertiesSet() throws Exception {
if (this.dataSource == null && this.nonTransactionalDataSource != null) {
this.dataSource = this.nonTransactionalDataSource;
@@ -689,14 +694,17 @@ public Scheduler getScheduler() {
return this.scheduler;
}
+ @Override
public Scheduler getObject() {
return this.scheduler;
}
+ @Override
public Class<? extends Scheduler> getObjectType() {
return (this.scheduler != null) ? this.scheduler.getClass() : Scheduler.class;
}
+ @Override
public boolean isSingleton() {
return true;
}
@@ -706,6 +714,7 @@ public boolean isSingleton() {
// Implementation of Lifecycle interface
//---------------------------------------------------------------------
+ @Override
public void start() throws SchedulingException {
if (this.scheduler != null) {
try {
@@ -717,6 +726,7 @@ public void start() throws SchedulingException {
}
}
+ @Override
public void stop() throws SchedulingException {
if (this.scheduler != null) {
try {
@@ -728,11 +738,13 @@ public void stop() throws SchedulingException {
}
}
+ @Override
public void stop(Runnable callback) throws SchedulingException {
stop();
callback.run();
}
+ @Override
public boolean isRunning() throws SchedulingException {
if (this.scheduler != null) {
try {
@@ -754,6 +766,7 @@ public boolean isRunning() throws SchedulingException {
* Shut down the Quartz scheduler on bean factory shutdown,
* stopping all scheduled jobs.
*/
+ @Override
public void destroy() throws SchedulerException {
logger.info("Shutting down Quartz Scheduler");
this.scheduler.shutdown(this.waitForJobsToCompleteOnShutdown); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleThreadPoolTaskExecutor.java | @@ -59,28 +59,33 @@ public void setWaitForJobsToCompleteOnShutdown(boolean waitForJobsToCompleteOnSh
this.waitForJobsToCompleteOnShutdown = waitForJobsToCompleteOnShutdown;
}
+ @Override
public void afterPropertiesSet() throws SchedulerConfigException {
initialize();
}
+ @Override
public void execute(Runnable task) {
Assert.notNull(task, "Runnable must not be null");
if (!runInThread(task)) {
throw new SchedulingException("Quartz SimpleThreadPool already shut down");
}
}
+ @Override
public void execute(Runnable task, long startTimeout) {
execute(task);
}
+ @Override
public Future<?> submit(Runnable task) {
FutureTask<Object> future = new FutureTask<Object>(task, null);
execute(future);
return future;
}
+ @Override
public <T> Future<T> submit(Callable<T> task) {
FutureTask<T> future = new FutureTask<T>(task);
execute(future);
@@ -90,11 +95,13 @@ public <T> Future<T> submit(Callable<T> task) {
/**
* This task executor prefers short-lived work units.
*/
+ @Override
public boolean prefersShortLivedTasks() {
return true;
}
+ @Override
public void destroy() {
shutdown(this.waitForJobsToCompleteOnShutdown);
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerBean.java | @@ -144,15 +144,18 @@ public void setJobDetail(JobDetail jobDetail) {
this.jobDetail = jobDetail;
}
+ @Override
public JobDetail getJobDetail() {
return this.jobDetail;
}
+ @Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
+ @Override
public void afterPropertiesSet() throws ParseException {
if (getName() == null) {
setName(this.beanName); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java | @@ -195,11 +195,13 @@ public void setMisfireInstructionName(String constantName) {
this.misfireInstruction = constants.asNumber(constantName).intValue();
}
+ @Override
public void setBeanName(String beanName) {
this.beanName = beanName;
}
+ @Override
public void afterPropertiesSet() throws ParseException {
if (this.name == null) {
this.name = this.beanName;
@@ -266,14 +268,17 @@ else if (this.startTime == null) {
}
+ @Override
public SimpleTrigger getObject() {
return this.simpleTrigger;
}
+ @Override
public Class<?> getObjectType() {
return SimpleTrigger.class;
}
+ @Override
public boolean isSingleton() {
return true;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SpringBeanJobFactory.java | @@ -63,6 +63,7 @@ public void setIgnoredUnknownProperties(String[] ignoredUnknownProperties) {
this.ignoredUnknownProperties = ignoredUnknownProperties;
}
+ @Override
public void setSchedulerContext(SchedulerContext schedulerContext) {
this.schedulerContext = schedulerContext;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactoryBean.java | @@ -56,19 +56,23 @@ public class FreeMarkerConfigurationFactoryBean extends FreeMarkerConfigurationF
private Configuration configuration;
+ @Override
public void afterPropertiesSet() throws IOException, TemplateException {
this.configuration = createConfiguration();
}
+ @Override
public Configuration getObject() {
return this.configuration;
}
+ @Override
public Class<? extends Configuration> getObjectType() {
return Configuration.class;
}
+ @Override
public boolean isSingleton() {
return true;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/ui/freemarker/SpringTemplateLoader.java | @@ -63,6 +63,7 @@ public SpringTemplateLoader(ResourceLoader resourceLoader, String templateLoader
}
}
+ @Override
public Object findTemplateSource(String name) throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("Looking for FreeMarker template with name [" + name + "]");
@@ -71,6 +72,7 @@ public Object findTemplateSource(String name) throws IOException {
return (resource.exists() ? resource : null);
}
+ @Override
public Reader getReader(Object templateSource, String encoding) throws IOException {
Resource resource = (Resource) templateSource;
try {
@@ -85,6 +87,7 @@ public Reader getReader(Object templateSource, String encoding) throws IOExcepti
}
+ @Override
public long getLastModified(Object templateSource) {
Resource resource = (Resource) templateSource;
try {
@@ -99,6 +102,7 @@ public long getLastModified(Object templateSource) {
}
}
+ @Override
public void closeTemplateSource(Object templateSource) throws IOException {
}
| true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java | @@ -53,19 +53,23 @@ public class VelocityEngineFactoryBean extends VelocityEngineFactory
private VelocityEngine velocityEngine;
+ @Override
public void afterPropertiesSet() throws IOException, VelocityException {
this.velocityEngine = createVelocityEngine();
}
+ @Override
public VelocityEngine getObject() {
return this.velocityEngine;
}
+ @Override
public Class<? extends VelocityEngine> getObjectType() {
return VelocityEngine.class;
}
+ @Override
public boolean isSingleton() {
return true;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java | @@ -50,6 +50,7 @@ public abstract class AbstractCachingConfiguration implements ImportAware {
@Autowired(required=false)
private Collection<CachingConfigurer> cachingConfigurers;
+ @Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableCaching = AnnotationAttributes.fromMap(
importMetadata.getAnnotationAttributes(EnableCaching.class.getName(), false)); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/annotation/CachingConfigurationSelector.java | @@ -39,6 +39,7 @@ public class CachingConfigurationSelector extends AdviceModeImportSelector<Enabl
* @return {@link ProxyCachingConfiguration} or {@code AspectJCacheConfiguration} for
* {@code PROXY} and {@code ASPECTJ} values of {@link EnableCaching#mode()}, respectively
*/
+ @Override
public String[] selectImports(AdviceMode adviceMode) {
switch (adviceMode) {
case PROXY: | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/annotation/SpringCacheAnnotationParser.java | @@ -41,6 +41,7 @@
@SuppressWarnings("serial")
public class SpringCacheAnnotationParser implements CacheAnnotationParser, Serializable {
+ @Override
public Collection<CacheOperation> parseCacheAnnotations(AnnotatedElement ae) {
Collection<CacheOperation> ops = null;
| true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java | @@ -83,10 +83,12 @@ public ConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, bool
}
+ @Override
public String getName() {
return this.name;
}
+ @Override
public ConcurrentMap getNativeCache() {
return this.store;
}
@@ -95,19 +97,23 @@ public boolean isAllowNullValues() {
return this.allowNullValues;
}
+ @Override
public ValueWrapper get(Object key) {
Object value = this.store.get(key);
return (value != null ? new SimpleValueWrapper(fromStoreValue(value)) : null);
}
+ @Override
public void put(Object key, Object value) {
this.store.put(key, toStoreValue(value));
}
+ @Override
public void evict(Object key) {
this.store.remove(key);
}
+ @Override
public void clear() {
this.store.clear();
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCacheFactoryBean.java | @@ -74,26 +74,31 @@ public void setAllowNullValues(boolean allowNullValues) {
this.allowNullValues = allowNullValues;
}
+ @Override
public void setBeanName(String beanName) {
if (!StringUtils.hasLength(this.name)) {
setName(beanName);
}
}
+ @Override
public void afterPropertiesSet() {
this.cache = (this.store != null ? new ConcurrentMapCache(this.name, this.store, this.allowNullValues) :
new ConcurrentMapCache(this.name, this.allowNullValues));
}
+ @Override
public ConcurrentMapCache getObject() {
return this.cache;
}
+ @Override
public Class<?> getObjectType() {
return ConcurrentMapCache.class;
}
+ @Override
public boolean isSingleton() {
return true;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCacheManager.java | @@ -71,10 +71,12 @@ public void setCacheNames(Collection<String> cacheNames) {
}
}
+ @Override
public Collection<String> getCacheNames() {
return Collections.unmodifiableSet(this.cacheMap.keySet());
}
+ @Override
public Cache getCache(String name) {
Cache cache = this.cacheMap.get(name);
if (cache == null && this.dynamic) { | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/config/AnnotationDrivenCacheBeanDefinitionParser.java | @@ -53,6 +53,7 @@ class AnnotationDrivenCacheBeanDefinitionParser implements BeanDefinitionParser
* {@link AopNamespaceUtils#registerAutoProxyCreatorIfNecessary
* register an AutoProxyCreator} with the container as necessary.
*/
+ @Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
String mode = element.getAttribute("mode");
if ("aspectj".equals(mode)) { | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/config/CacheNamespaceHandler.java | @@ -51,6 +51,7 @@ static BeanDefinition parseKeyGenerator(Element element, BeanDefinition def) {
return def;
}
+ @Override
public void init() {
registerBeanDefinitionParser("annotation-driven", new AnnotationDrivenCacheBeanDefinitionParser());
registerBeanDefinitionParser("advice", new CacheAdviceParser()); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/interceptor/AbstractFallbackCacheOperationSource.java | @@ -84,6 +84,7 @@ public abstract class AbstractFallbackCacheOperationSource implements CacheOpera
* @return {@link CacheOperation} for this method, or {@code null} if the method
* is not cacheable
*/
+ @Override
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) {
// First, see if we have a cached value.
Object cacheKey = getCacheKey(method, targetClass); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/interceptor/BeanFactoryCacheOperationSourceAdvisor.java | @@ -57,6 +57,7 @@ public void setClassFilter(ClassFilter classFilter) {
this.pointcut.setClassFilter(classFilter);
}
+ @Override
public Pointcut getPointcut() {
return this.pointcut;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java | @@ -129,6 +129,7 @@ public KeyGenerator getKeyGenerator() {
return this.keyGenerator;
}
+ @Override
public void afterPropertiesSet() {
if (this.cacheManager == null) {
throw new IllegalStateException("'cacheManager' is required"); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/interceptor/CacheInterceptor.java | @@ -49,10 +49,12 @@ private static class ThrowableWrapper extends RuntimeException {
}
}
+ @Override
public Object invoke(final MethodInvocation invocation) throws Throwable {
Method method = invocation.getMethod();
Invoker aopAllianceInvoker = new Invoker() {
+ @Override
public Object invoke() {
try {
return invocation.proceed(); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/interceptor/CacheOperationSourcePointcut.java | @@ -33,6 +33,7 @@
@SuppressWarnings("serial")
abstract class CacheOperationSourcePointcut extends StaticMethodMatcherPointcut implements Serializable {
+ @Override
public boolean matches(Method method, Class<?> targetClass) {
CacheOperationSource cas = getCacheOperationSource();
return (cas != null && !CollectionUtils.isEmpty(cas.getCacheOperations(method, targetClass))); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/interceptor/CompositeCacheOperationSource.java | @@ -52,6 +52,7 @@ public final CacheOperationSource[] getCacheOperationSources() {
return this.cacheOperationSources;
}
+ @Override
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) {
Collection<CacheOperation> ops = null;
| true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/interceptor/DefaultKeyGenerator.java | @@ -36,6 +36,7 @@ public class DefaultKeyGenerator implements KeyGenerator {
public static final int NO_PARAM_KEY = 0;
public static final int NULL_PARAM_KEY = 53;
+ @Override
public Object generate(Object target, Method method, Object... params) {
if (params.length == 1) {
return (params[0] == null ? NULL_PARAM_KEY : params[0]); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/interceptor/NameMatchCacheOperationSource.java | @@ -71,6 +71,7 @@ public void addCacheMethod(String methodName, Collection<CacheOperation> ops) {
this.nameMap.put(methodName, ops);
}
+ @Override
public Collection<CacheOperation> getCacheOperations(Method method, Class<?> targetClass) {
// look for direct name match
String methodName = method.getName(); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/support/AbstractCacheManager.java | @@ -42,6 +42,7 @@ public abstract class AbstractCacheManager implements CacheManager, Initializing
private Set<String> cacheNames = new LinkedHashSet<String>(16);
+ @Override
public void afterPropertiesSet() {
Collection<? extends Cache> caches = loadCaches();
@@ -70,10 +71,12 @@ protected Cache decorateCache(Cache cache) {
}
+ @Override
public Cache getCache(String name) {
return this.cacheMap.get(name);
}
+ @Override
public Collection<String> getCacheNames() {
return Collections.unmodifiableSet(this.cacheNames);
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/support/CompositeCacheManager.java | @@ -59,13 +59,15 @@ public void setFallbackToNoOpCache(boolean fallbackToNoOpCache) {
this.fallbackToNoOpCache = fallbackToNoOpCache;
}
+ @Override
public void afterPropertiesSet() {
if (this.fallbackToNoOpCache) {
this.cacheManagers.add(new NoOpCacheManager());
}
}
+ @Override
public Cache getCache(String name) {
for (CacheManager cacheManager : this.cacheManagers) {
Cache cache = cacheManager.getCache(name);
@@ -76,6 +78,7 @@ public Cache getCache(String name) {
return null;
}
+ @Override
public Collection<String> getCacheNames() {
List<String> names = new ArrayList<String>();
for (CacheManager manager : this.cacheManagers) { | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/support/NoOpCacheManager.java | @@ -48,6 +48,7 @@ public class NoOpCacheManager implements CacheManager {
* This implementation always returns a {@link Cache} implementation that will not store items.
* Additionally, the request cache will be remembered by the manager for consistency.
*/
+ @Override
public Cache getCache(String name) {
Cache cache = this.caches.get(name);
if (cache == null) {
@@ -63,6 +64,7 @@ public Cache getCache(String name) {
/**
* This implementation returns the name of the caches previously requested.
*/
+ @Override
public Collection<String> getCacheNames() {
synchronized (this.cacheNames) {
return Collections.unmodifiableSet(this.cacheNames);
@@ -78,24 +80,30 @@ public NoOpCache(String name) {
this.name = name;
}
+ @Override
public void clear() {
}
+ @Override
public void evict(Object key) {
}
+ @Override
public ValueWrapper get(Object key) {
return null;
}
+ @Override
public String getName() {
return this.name;
}
+ @Override
public Object getNativeCache() {
return null;
}
+ @Override
public void put(Object key, Object value) {
}
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/cache/support/SimpleValueWrapper.java | @@ -42,6 +42,7 @@ public SimpleValueWrapper(Object value) {
/**
* Simply returns the value as given at construction time.
*/
+ @Override
public Object get() {
return this.value;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/ConfigurableApplicationContext.java | @@ -100,6 +100,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
/**
* Return the Environment for this application context in configurable form.
*/
+ @Override
ConfigurableEnvironment getEnvironment();
/**
@@ -158,6 +159,7 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
* <p>This method can be called multiple times without side effects: Subsequent
* {@code close} calls on an already closed context will be ignored.
*/
+ @Override
void close();
/** | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/access/ContextBeanFactoryReference.java | @@ -48,6 +48,7 @@ public ContextBeanFactoryReference(ApplicationContext applicationContext) {
}
+ @Override
public BeanFactory getFactory() {
if (this.applicationContext == null) {
throw new IllegalStateException(
@@ -56,6 +57,7 @@ public BeanFactory getFactory() {
return this.applicationContext;
}
+ @Override
public void release() {
if (this.applicationContext != null) {
ApplicationContext savedCtx; | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/access/ContextJndiBeanFactoryLocator.java | @@ -57,6 +57,7 @@ public class ContextJndiBeanFactoryLocator extends JndiLocatorSupport implements
* will be created from the combined resources.
* @see #createBeanFactory
*/
+ @Override
public BeanFactoryReference useBeanFactory(String factoryKey) throws BeansException {
try {
String beanFactoryPath = lookup(factoryKey, String.class); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/AdviceModeImportSelector.java | @@ -65,6 +65,7 @@ protected String getAdviceModeAttributeName() {
* on the importing {@code @Configuration} class or if {@link #selectImports(AdviceMode)}
* returns {@code null}
*/
+ @Override
public final String[] selectImports(AnnotationMetadata importingClassMetadata) {
Class<?> annoType = GenericTypeResolver.resolveTypeArgument(this.getClass(), AdviceModeImportSelector.class);
| true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/AnnotationBeanNameGenerator.java | @@ -64,6 +64,7 @@ public class AnnotationBeanNameGenerator implements BeanNameGenerator {
private static final String COMPONENT_ANNOTATION_CLASSNAME = "org.springframework.stereotype.Component";
+ @Override
public String generateBeanName(BeanDefinition definition, BeanDefinitionRegistry registry) {
if (definition instanceof AnnotatedBeanDefinition) {
String beanName = determineBeanNameFromAnnotation((AnnotatedBeanDefinition) definition); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigBeanDefinitionParser.java | @@ -38,6 +38,7 @@
*/
public class AnnotationConfigBeanDefinitionParser implements BeanDefinitionParser {
+ @Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
Object source = parserContext.extractSource(element);
| true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/AnnotationScopeMetadataResolver.java | @@ -74,6 +74,7 @@ public void setScopeAnnotationType(Class<? extends Annotation> scopeAnnotationTy
}
+ @Override
public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
ScopeMetadata metadata = new ScopeMetadata();
if (definition instanceof AnnotatedBeanDefinition) { | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/AspectJAutoProxyRegistrar.java | @@ -39,6 +39,7 @@ class AspectJAutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
* of the @{@link EnableAspectJAutoProxy#proxyTargetClass()} attribute on the importing
* {@code @Configuration} class.
*/
+ @Override
public void registerBeanDefinitions(
AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
| true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java | @@ -56,6 +56,7 @@ public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
* {@code proxyTargetClass} attributes, the APC can be registered and configured all
* the same.
*/
+ @Override
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
boolean candidateFound = false;
Set<String> annoTypes = importingClassMetadata.getAnnotationTypes(); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java | @@ -117,6 +117,7 @@ public ClassPathScanningCandidateComponentProvider(boolean useDefaultFilters, En
* @see org.springframework.core.io.support.ResourcePatternResolver
* @see org.springframework.core.io.support.PathMatchingResourcePatternResolver
*/
+ @Override
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader);
this.metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader);
@@ -157,6 +158,7 @@ public void setEnvironment(Environment environment) {
this.environment = environment;
}
+ @Override
public final Environment getEnvironment() {
return this.environment;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessor.java | @@ -266,6 +266,7 @@ public void setResourceFactory(BeanFactory resourceFactory) {
this.resourceFactory = resourceFactory;
}
+ @Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
Assert.notNull(beanFactory, "BeanFactory must not be null");
this.beanFactory = beanFactory;
@@ -284,14 +285,17 @@ public void postProcessMergedBeanDefinition(RootBeanDefinition beanDefinition, C
}
}
+ @Override
public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
return null;
}
+ @Override
public boolean postProcessAfterInstantiation(Object bean, String beanName) throws BeansException {
return true;
}
+ @Override
public PropertyValues postProcessPropertyValues(
PropertyValues pvs, PropertyDescriptor[] pds, Object bean, String beanName) throws BeansException {
| true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/ComponentScanBeanDefinitionParser.java | @@ -75,6 +75,7 @@ public class ComponentScanBeanDefinitionParser implements BeanDefinitionParser {
private static final String FILTER_EXPRESSION_ATTRIBUTE = "expression";
+ @Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
String[] basePackages = StringUtils.tokenizeToStringArray(element.getAttribute(BASE_PACKAGE_ATTRIBUTE),
ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/ConditionalAnnotationHelper.java | @@ -183,26 +183,31 @@ private Environment deduceEnvironment(BeanDefinitionRegistry registry) {
return null;
}
+ @Override
public BeanDefinitionRegistry getRegistry() {
return this.registry;
}
+ @Override
public Environment getEnvironment() {
return this.environment;
}
+ @Override
public ConfigurableListableBeanFactory getBeanFactory() {
Assert.state(this.beanFactory != null, "Unable to locate the BeanFactory");
return this.beanFactory;
}
+ @Override
public ResourceLoader getResourceLoader() {
if (registry instanceof ResourceLoader) {
return (ResourceLoader) registry;
}
return null;
}
+ @Override
public ClassLoader getClassLoader() {
ResourceLoader resourceLoader = getResourceLoader();
return (resourceLoader == null ? null : resourceLoader.getClassLoader()); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java | @@ -326,6 +326,7 @@ private ConfigurationClassBeanDefinition(ConfigurationClassBeanDefinition origin
this.annotationMetadata = original.annotationMetadata;
}
+ @Override
public AnnotationMetadata getMetadata() {
return this.annotationMetadata;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java | @@ -206,12 +206,14 @@ public Class<?>[] getCallbackTypes() {
private static class DisposableBeanMethodInterceptor implements MethodInterceptor,
ConditionalCallback {
+ @Override
public boolean isMatch(Method candidateMethod) {
return candidateMethod.getName().equals("destroy")
&& candidateMethod.getParameterTypes().length == 0
&& DisposableBean.class.isAssignableFrom(candidateMethod.getDeclaringClass());
}
+ @Override
public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
Enhancer.registerStaticCallbacks(obj.getClass(), null);
// does the actual (non-CGLIB) superclass actually implement DisposableBean?
@@ -235,13 +237,15 @@ public Object intercept(Object obj, Method method, Object[] args, MethodProxy pr
private static class BeanFactoryAwareMethodInterceptor implements MethodInterceptor,
ConditionalCallback {
+ @Override
public boolean isMatch(Method candidateMethod) {
return candidateMethod.getName().equals("setBeanFactory")
&& candidateMethod.getParameterTypes().length == 1
&& candidateMethod.getParameterTypes()[0].equals(BeanFactory.class)
&& BeanFactoryAware.class.isAssignableFrom(candidateMethod.getDeclaringClass());
}
+ @Override
public Object intercept(Object obj, Method method, Object[] args,
MethodProxy proxy) throws Throwable {
Field field = obj.getClass().getDeclaredField(BEAN_FACTORY_FIELD);
@@ -266,6 +270,7 @@ public Object intercept(Object obj, Method method, Object[] args,
*/
private static class BeanMethodInterceptor implements MethodInterceptor, ConditionalCallback {
+ @Override
public boolean isMatch(Method candidateMethod) {
return BeanAnnotationHelper.isBeanAnnotated(candidateMethod);
}
@@ -277,6 +282,7 @@ public boolean isMatch(Method candidateMethod) {
* invoking the super implementation of the proxied method i.e., the actual
* {@code @Bean} method.
*/
+ @Override
public Object intercept(Object enhancedConfigInstance, Method beanMethod, Object[] beanMethodArgs,
MethodProxy cglibMethodProxy) throws Throwable {
@@ -389,6 +395,7 @@ private Object enhanceFactoryBean(Class<?> fbClass, final ConfigurableBeanFactor
enhancer.setSuperclass(fbClass);
enhancer.setUseFactory(false);
enhancer.setCallback(new MethodInterceptor() {
+ @Override
public Object intercept(Object obj, Method method, Object[] args,
MethodProxy proxy) throws Throwable {
if (method.getName().equals("getObject") && args.length == 0) { | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java | @@ -90,6 +90,7 @@ class ConfigurationClassParser {
private static final Comparator<DeferredImportSelectorHolder> DEFERRED_IMPORT_COMPARATOR =
new Comparator<ConfigurationClassParser.DeferredImportSelectorHolder>() {
+ @Override
public int compare(DeferredImportSelectorHolder o1,
DeferredImportSelectorHolder o2) {
return AnnotationAwareOrderComparator.INSTANCE.compare(
@@ -535,6 +536,7 @@ public void registerImport(String importingClass, String importedClass) {
this.imports.put(importedClass, importingClass);
}
+ @Override
public String getImportingClassFor(String importedClass) {
return this.imports.get(importedClass);
}
@@ -548,6 +550,7 @@ public String getImportingClassFor(String importedClass) {
public boolean contains(Object elem) {
ConfigurationClass configClass = (ConfigurationClass) elem;
Comparator<ConfigurationClass> comparator = new Comparator<ConfigurationClass>() {
+ @Override
public int compare(ConfigurationClass first, ConfigurationClass second) {
return first.getMetadata().getClassName().equals(second.getMetadata().getClassName()) ? 0 : 1;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java | @@ -184,16 +184,19 @@ public void setBeanNameGenerator(BeanNameGenerator beanNameGenerator) {
this.importBeanNameGenerator = beanNameGenerator;
}
+ @Override
public void setEnvironment(Environment environment) {
Assert.notNull(environment, "Environment must not be null");
this.environment = environment;
}
+ @Override
public void setResourceLoader(ResourceLoader resourceLoader) {
Assert.notNull(resourceLoader, "ResourceLoader must not be null");
this.resourceLoader = resourceLoader;
}
+ @Override
public void setBeanClassLoader(ClassLoader beanClassLoader) {
this.beanClassLoader = beanClassLoader;
if (!this.setMetadataReaderFactoryCalled) {
@@ -205,6 +208,7 @@ public void setBeanClassLoader(ClassLoader beanClassLoader) {
/**
* Derive further bean definitions from the configuration classes in the registry.
*/
+ @Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
RootBeanDefinition iabpp = new RootBeanDefinition(ImportAwareBeanPostProcessor.class);
iabpp.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
@@ -228,6 +232,7 @@ public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
* Prepare the Configuration classes for servicing bean requests at runtime
* by replacing them with CGLIB-enhanced subclasses.
*/
+ @Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
int factoryId = System.identityHashCode(beanFactory);
if (this.factoriesPostProcessed.contains(factoryId)) {
@@ -366,10 +371,12 @@ private static class ImportAwareBeanPostProcessor implements PriorityOrdered, Be
private BeanFactory beanFactory;
+ @Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
}
+ @Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof ImportAware) {
ImportRegistry importRegistry = this.beanFactory.getBean(IMPORT_REGISTRY_BEAN_NAME, ImportRegistry.class);
@@ -392,10 +399,12 @@ public Object postProcessBeforeInitialization(Object bean, String beanName) thro
return bean;
}
+ @Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
+ @Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
} | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/Jsr330ScopeMetadataResolver.java | @@ -81,6 +81,7 @@ protected String resolveScopeName(String annotationType) {
}
+ @Override
public ScopeMetadata resolveScopeMetadata(BeanDefinition definition) {
ScopeMetadata metadata = new ScopeMetadata();
metadata.setScopeName(BeanDefinition.SCOPE_PROTOTYPE); | true |
Other | spring-projects | spring-framework | 94685481162a93666fc2f39b66223833a6bcb418.json | Add @Override to remaining source files
Issue: SPR-10130 | spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfiguration.java | @@ -52,13 +52,15 @@ public class LoadTimeWeavingConfiguration implements ImportAware, BeanClassLoade
private ClassLoader beanClassLoader;
+ @Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableLTW = MetadataUtils.attributesFor(importMetadata, EnableLoadTimeWeaving.class);
Assert.notNull(this.enableLTW,
"@EnableLoadTimeWeaving is not present on importing class " +
importMetadata.getClassName());
}
+ @Override
public void setBeanClassLoader(ClassLoader beanClassLoader) {
this.beanClassLoader = beanClassLoader;
} | true |
Other | spring-projects | spring-framework | 0634555424a8742bbe95333c49975437af6eacf8.json | Delay check if pattern ends with slash
This is a minor fix with no actual impact.
Issue: SPR-10504 | spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java | @@ -168,6 +168,7 @@ protected String getToStringInfix() {
* <li>If neither instance has patterns, use an empty String (i.e. "").
* </ul>
*/
+ @Override
public PatternsRequestCondition combine(PatternsRequestCondition other) {
Set<String> result = new LinkedHashSet<String>();
if (!this.patterns.isEmpty() && !other.patterns.isEmpty()) {
@@ -209,6 +210,7 @@ else if (!other.patterns.isEmpty()) {
* or a new condition with sorted matching patterns;
* or {@code null} if no patterns match.
*/
+ @Override
public PatternsRequestCondition getMatchingCondition(HttpServletRequest request) {
if (this.patterns.isEmpty()) {
return this;
@@ -256,9 +258,8 @@ private String getMatchingPattern(String pattern, String lookupPath) {
if (this.pathMatcher.match(pattern, lookupPath)) {
return pattern;
}
- boolean endsWithSlash = pattern.endsWith("/");
if (this.useTrailingSlashMatch) {
- if (!endsWithSlash && this.pathMatcher.match(pattern + "/", lookupPath)) {
+ if (!pattern.endsWith("/") && this.pathMatcher.match(pattern + "/", lookupPath)) {
return pattern +"/";
}
}
@@ -277,6 +278,7 @@ private String getMatchingPattern(String pattern, String lookupPath) {
* contain only patterns that match the request and are sorted with
* the best matches on top.
*/
+ @Override
public int compareTo(PatternsRequestCondition other, HttpServletRequest request) {
String lookupPath = this.pathHelper.getLookupPathForRequest(request);
Comparator<String> patternComparator = this.pathMatcher.getPatternComparator(lookupPath); | false |
Other | spring-projects | spring-framework | f35dfd4107ba093de5e0cc9eebe62a7b76a19183.json | Update stale external javadoc links
Certain external javadoc links were broken or out of date, namely
Hibernate, Java SE and EE 6, Quartz, and Apache Pluto. All resolve
properly now.
Issue: SPR-8720 | build-spring-framework/build.xml | @@ -41,15 +41,15 @@
<presetdef name="javadoc.links">
<javadoc>
- <link href="http://java.sun.com/javase/6/docs/api"/>
- <link href="http://java.sun.com/j2ee/1.4/docs/api"/>
+ <link href="http://download.oracle.com/javase/6/docs/api"/>
+ <link href="http://download.oracle.com/javaee/6/api"/>
<link href="http://aopalliance.sourceforge.net/doc"/>
<!-- Caucho Burlap/Hessian -->
<link href="http://cglib.sourceforge.net/apidocs"/>
<!-- EasyMock -->
<link href="http://ehcache.sourceforge.net/apidocs"/>
<link href="http://freemarker.sourceforge.net/docs/api/"/>
- <link href="http://www.hibernate.org/hib_docs/v3/api"/>
+ <link href="http://docs.jboss.org/hibernate/core/3.6/javadocs/"/>
<!-- iBATIS -->
<!-- iText -->
<!-- Commons Attributes -->
@@ -69,8 +69,8 @@
<link href="http://logging.apache.org/log4j/docs/api/"/>
<link href="http://jakarta.apache.org/regexp/apidocs/"/>
<link href="http://jakarta.apache.org/poi/apidocs/"/>
- <link href="http://portals.apache.org/pluto/multiproject/portlet-api/apidocs/"/>
- <link href="http://www.opensymphony.com/quartz/api/"/>
+ <link href="http://portals.apache.org/pluto/portlet-1.0-apidocs/"/>
+ <link href="http://www.quartz-scheduler.org/api/2.1.0/"/>
<link href="http://struts.apache.org/struts-doc-1.2.9/api/"/>
<link href="http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/"/>
<link href="http://tiles.apache.org/framework/apidocs/"/>
| false |
Other | spring-projects | spring-framework | 870d9034174ed9373619c13fcc71f0cf3bc57d30.json | Add INFER_METHOD constant and update @Bean Javadoc
In anticipation of 'destroy method inference' feature, introduce
ConfigurationClassUtils#INFER_METHOD and update @Bean#destroyMethod to
reflect its use.
Issue: SPR-8751 | org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java | @@ -168,11 +168,21 @@
* The optional name of a method to call on the bean instance upon closing the
* application context, for example a {@code close()} method on a {@code DataSource}.
* The method must have no arguments but may throw any exception.
+ * <p>As a convenience to the user, the container will attempt to infer a destroy
+ * method based on the return type of the {@code @Bean} method. For example, given a
+ * {@code @Bean} method returning an Apache Commons DBCP {@code BasicDataSource}, the
+ * container will notice the {@code close()} method available on that type and
+ * automatically register it as the {@code destroyMethod}. By contrast, for a return
+ * type of JDBC {@code DataSource} interface (which does not declare a {@code close()}
+ * method, no inference is possible and the user must fall back to manually declaring
+ * {@code @Bean(destroyMethod="close")}.
+ * <p>To disable destroy method inference for a particular {@code @Bean}, specify an
+ * empty string as the value, e.g. {@code @Bean(destroyMethod="")}.
* <p>Note: Only invoked on beans whose lifecycle is under the full control of the
* factory, which is always the case for singletons but not guaranteed
* for any other scope.
* @see org.springframework.context.ConfigurableApplicationContext#close()
*/
- String destroyMethod() default "";
+ String destroyMethod() default ConfigurationClassUtils.INFER_METHOD;
} | true |
Other | spring-projects | spring-framework | 870d9034174ed9373619c13fcc71f0cf3bc57d30.json | Add INFER_METHOD constant and update @Bean Javadoc
In anticipation of 'destroy method inference' feature, introduce
ConfigurationClassUtils#INFER_METHOD and update @Bean#destroyMethod to
reflect its use.
Issue: SPR-8751 | org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassUtils.java | @@ -46,6 +46,8 @@ abstract class ConfigurationClassUtils {
private static final String CONFIGURATION_CLASS_ATTRIBUTE =
Conventions.getQualifiedAttributeName(ConfigurationClassPostProcessor.class, "configurationClass");
+ static final String INFER_METHOD = ""; // TODO SPR-8751 update to '-' or some such
+
/**
* Check whether the given bean definition is a candidate for a configuration class, | true |
Other | spring-projects | spring-framework | 6b4ef0237c147a3fe02b446bdc831a228c5a8da7.json | Add code examples to and polish @Bean Javadoc | org.springframework.context/src/main/java/org/springframework/context/annotation/Bean.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,34 +27,83 @@
/**
* Indicates that a method produces a bean to be managed by the Spring container. The
* names and semantics of the attributes to this annotation are intentionally similar
- * to those of the {@code <bean/>} element in the Spring XML schema.
- *
- * <p>Note that the {@code @Bean} annotation does not provide attributes for scope,
- * primary or lazy. Rather, it should be used in conjunction with {@link Scope @Scope},
- * {@link Primary @Primary}, and {@link Lazy @Lazy} annotations to achieve
- * those semantics. The same annotations can also be used at the type level, e.g. for
- * component scanning.
+ * to those of the {@code <bean/>} element in the Spring XML schema. For example:
+ * <pre class="code">
+ * @Bean
+ * public MyBean myBean() {
+ * // instantiate and configure MyBean obj
+ * return obj;
+ * }</pre>
*
* <p>While a {@link #name()} attribute is available, the default strategy for determining
* the name of a bean is to use the name of the Bean method. This is convenient and
* intuitive, but if explicit naming is desired, the {@code name()} attribute may be used.
* Also note that {@code name()} accepts an array of Strings. This is in order to allow
* for specifying multiple names (i.e., aliases) for a single bean.
+ * <pre class="code">
+ * @Bean(name={"b1","b2"}) // bean available as 'b1' and 'b2', but not 'myBean'
+ * public MyBean myBean() {
+ * // instantiate and configure MyBean obj
+ * return obj;
+ * }</pre>
*
- * <p>The <code>@Bean</code> annotation may be used on any methods in an <code>@Component</code>
- * class, in which case they will get processed in a configuration class 'lite' mode where
+ * <p>Note that the {@code @Bean} annotation does not provide attributes for scope,
+ * primary or lazy. Rather, it should be used in conjunction with {@link Scope @Scope},
+ * {@link Primary @Primary}, and {@link Lazy @Lazy} annotations to achieve
+ * those semantics. For example:
+ * <pre class="code">
+ * @Bean
+ * @Scope("prototype")
+ * public MyBean myBean() {
+ * // instantiate and configure MyBean obj
+ * return obj;
+ * }</pre>
+ *
+ * <p>Typically, {@code @Bean} methods are declared within {@code @Configuration}
+ * classes. In this case, bean methods may reference other <code>@Bean</code> methods
+ * on the same class by calling them <i>directly</i>. This ensures that references between
+ * beans are strongly typed and navigable. Such so-called 'inter-bean references' are
+ * guaranteed to respect scoping and AOP semantics, just like <code>getBean</code> lookups
+ * would. These are the semantics known from the original 'Spring JavaConfig' project
+ * which require CGLIB subclassing of each such configuration class at runtime. As a
+ * consequence, {@code @Configuration} classes and their factory methods must not be
+ * marked as final or private in this mode. For example:
+ * <pre class="code">
+ * @Configuration
+ * public class AppConfig {
+ * @Bean
+ * public FooService fooService() {
+ * return new FooService(fooRepository());
+ * }
+ * @Bean
+ * public FooRepository fooRepository() {
+ * return new JdbcFooRepository(dataSource());
+ * }
+ * // ...
+ * }</pre>
+ *
+ * <p>{@code @Bean} methods may also be declared wihtin any {@code @Component} class, in
+ * which case they will get processed in a configuration class 'lite' mode in which
* they will simply be called as plain factory methods from the container (similar to
- * <code>factory-method</code> declarations in XML). The containing component classes remain
- * unmodified in this case, and there are no unusual constraints for factory methods.
+ * {@code factory-method} declarations in XML). The containing component classes remain
+ * unmodified in this case, and there are no unusual constraints for factory methods,
+ * however, scoping semantics are not respected as described above for inter-bean method
+ * invocations in this mode. For example:
+ * <pre class="code">
+ * @Component
+ * public class Calculator {
+ * public int sum(int a, int b) {
+ * return a+b;
+ * }
+ *
+ * @Bean
+ * public MyBean myBean() {
+ * return new MyBean();
+ * }
+ * }</pre>
*
- * <p>As an advanced mode, <code>@Bean</code> may also be used within <code>@Configuration</code>
- * component classes. In this case, bean methods may reference other <code>@Bean</code> methods
- * on the same class by calling them <i>directly</i>. This ensures that references between beans
- * are strongly typed and navigable. Such so-called 'inter-bean references' are guaranteed to
- * respect scoping and AOP semantics, just like <code>getBean</code> lookups would. These are
- * the semantics known from the original 'Spring JavaConfig' project which require CGLIB
- * subclassing of each such configuration class at runtime. As a consequence, configuration
- * classes and their factory methods must not be marked as final or private in this mode.
+ * <p>See @{@link Configuration} Javadoc for further details including how to bootstrap
+ * the container using {@link AnnotationConfigApplicationContext} and friends.
*
* <h3>A note on {@code BeanFactoryPostProcessor}-returning {@code @Bean} methods</h3>
* <p>Special consideration must be taken for {@code @Bean} methods that return Spring
@@ -81,12 +130,12 @@
* @author Chris Beams
* @author Juergen Hoeller
* @since 3.0
- * @see org.springframework.stereotype.Component
* @see Configuration
* @see Scope
* @see DependsOn
* @see Lazy
* @see Primary
+ * @see org.springframework.stereotype.Component
* @see org.springframework.beans.factory.annotation.Autowired
* @see org.springframework.beans.factory.annotation.Value
*/
@@ -110,7 +159,8 @@
/**
* The optional name of a method to call on the bean instance during initialization.
* Not commonly used, given that the method may be called programmatically directly
- * within the body of a Bean-annotated method.
+ * within the body of a Bean-annotated method. Default value is {@code ""}, indicating
+ * that no init method should be called.
*/
String initMethod() default "";
| false |
Other | spring-projects | spring-framework | 34956d30b3f628f6a48451eb43911d5665548127.json | Fix doc typo in AbstractAutowireCapableBeanFactory | org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java | @@ -656,7 +656,7 @@ protected Class getTypeForFactoryMethod(String beanName, RootBeanDefinition mbd,
/**
* This implementation attempts to query the FactoryBean's generic parameter metadata
- * if present to determin the object type. If not present, i.e. the FactoryBean is
+ * if present to determine the object type. If not present, i.e. the FactoryBean is
* declared as a raw type, checks the FactoryBean's <code>getObjectType</code> method
* on a plain instance of the FactoryBean, without bean properties applied yet.
* If this doesn't return a type yet, a full creation of the FactoryBean is | false |
Other | spring-projects | spring-framework | faba5941f74ab6967cc712b7c4ce25c026c7fb88.json | Provide ConfigurationClass#toString implementation
For ease during debugging; prompted while fixing SPR-8761. | org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClass.java | @@ -151,6 +151,11 @@ public int hashCode() {
return getMetadata().getClassName().hashCode();
}
+ @Override
+ public String toString() {
+ return String.format("[ConfigurationClass:beanName=%s,resource=%s]", this.beanName, this.resource);
+ }
+
/**
* Configuration classes must be non-final to accommodate CGLIB subclassing. | false |
Other | spring-projects | spring-framework | 91f05c8b9d4e108e744484d808564a95b618e731.json | Avoid creation of unnecessary Environment objects
Prior to this change, any instantiation of an
AnnotationConfigApplicationContext would trigger the creation of three
StandardEnvironment objects: one for the ApplicationContext, one for the
AnnotatedBeanDefinitionReader, and one for the
ClassPathBeanDefinitionScanner.
The latter two are immediately swapped out when the ApplicationContext
delegates its environment to these subordinate objects anyway. Not only
is it inefficient to create these two extra Environments, it creates
confusion when debug-level logging is turned on. From the user's
perspective and in practice, there is only one Environment; logging
should reflect that.
This change ensures that only one Environment object is ever created for
a given ApplicationContext. If an AnnotatedBeanDefinitionReader or
ClassPathBeanDefinitionScanner are used in isolation, e.g. against a
plain BeanFactory/BeanDefinitionRegistry, then they will still create
their own local StandardEnvironment object.
All public API compatibility is preserved; new constructors have been
added where necessary to accommodate passing an Environment directly
to ABDR ar CPBDS. | org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotatedBeanDefinitionReader.java | @@ -45,25 +45,41 @@ public class AnnotatedBeanDefinitionReader {
private final BeanDefinitionRegistry registry;
- private Environment environment = new StandardEnvironment();
+ private Environment environment;
private BeanNameGenerator beanNameGenerator = new AnnotationBeanNameGenerator();
private ScopeMetadataResolver scopeMetadataResolver = new AnnotationScopeMetadataResolver();
/**
- * Create a new {@code AnnotatedBeanDefinitionReader} for the given bean factory.
+ * Create a new {@code AnnotatedBeanDefinitionReader} for the given registry.
+ * If the registry is {@link EnvironmentCapable}, e.g. is an {@code ApplicationContext},
+ * the {@link Environment} will be inherited, otherwise a new
+ * {@link StandardEnvironment} will be created and used.
* @param registry the {@code BeanFactory} to load bean definitions into,
* in the form of a {@code BeanDefinitionRegistry}
+ * @see #AnnotatedBeanDefinitionReader(BeanDefinitionRegistry, Environment)
+ * @see #setEnvironment(Environment)
*/
public AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry) {
+ this(registry, getOrCreateEnvironment(registry));
+ }
+
+ /**
+ * Create a new {@code AnnotatedBeanDefinitionReader} for the given registry and using
+ * the given {@link Environment}.
+ * @param registry the {@code BeanFactory} to load bean definitions into,
+ * in the form of a {@code BeanDefinitionRegistry}
+ * @param environment the {@code Environment} to use when evaluating bean definition
+ * profiles.
+ * @since 3.1
+ */
+ public AnnotatedBeanDefinitionReader(BeanDefinitionRegistry registry, Environment environment) {
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
- this.registry = registry;
+ Assert.notNull(environment, "Environment must not be null");
- // Inherit Environment if possible
- if (this.registry instanceof EnvironmentCapable) {
- this.environment = ((EnvironmentCapable) this.registry).getEnvironment();
- }
+ this.registry = registry;
+ this.environment = environment;
AnnotationConfigUtils.registerAnnotationConfigProcessors(this.registry);
}
@@ -144,4 +160,18 @@ public void registerBean(Class<?> annotatedClass, String name, Class<? extends A
definitionHolder = AnnotationConfigUtils.applyScopedProxyMode(scopeMetadata, definitionHolder, this.registry);
BeanDefinitionReaderUtils.registerBeanDefinition(definitionHolder, this.registry);
}
+
+
+ /**
+ * Get the Environment from the given registry if possible, otherwise return a new
+ * StandardEnvironment.
+ */
+ private static Environment getOrCreateEnvironment(BeanDefinitionRegistry registry) {
+ Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
+ if (registry instanceof EnvironmentCapable) {
+ return ((EnvironmentCapable) registry).getEnvironment();
+ }
+ return new StandardEnvironment();
+ }
+
}
| true |
Other | spring-projects | spring-framework | 91f05c8b9d4e108e744484d808564a95b618e731.json | Avoid creation of unnecessary Environment objects
Prior to this change, any instantiation of an
AnnotationConfigApplicationContext would trigger the creation of three
StandardEnvironment objects: one for the ApplicationContext, one for the
AnnotatedBeanDefinitionReader, and one for the
ClassPathBeanDefinitionScanner.
The latter two are immediately swapped out when the ApplicationContext
delegates its environment to these subordinate objects anyway. Not only
is it inefficient to create these two extra Environments, it creates
confusion when debug-level logging is turned on. From the user's
perspective and in practice, there is only one Environment; logging
should reflect that.
This change ensures that only one Environment object is ever created for
a given ApplicationContext. If an AnnotatedBeanDefinitionReader or
ClassPathBeanDefinitionScanner are used in isolation, e.g. against a
plain BeanFactory/BeanDefinitionRegistry, then they will still create
their own local StandardEnvironment object.
All public API compatibility is preserved; new constructors have been
added where necessary to accommodate passing an Environment directly
to ABDR ar CPBDS. | org.springframework.context/src/main/java/org/springframework/context/annotation/AnnotationConfigApplicationContext.java | @@ -47,17 +47,18 @@
*/
public class AnnotationConfigApplicationContext extends GenericApplicationContext {
- private final AnnotatedBeanDefinitionReader reader = new AnnotatedBeanDefinitionReader(this);
+ private final AnnotatedBeanDefinitionReader reader;
- private final ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(this);
+ private final ClassPathBeanDefinitionScanner scanner;
/**
* Create a new AnnotationConfigApplicationContext that needs to be populated
* through {@link #register} calls and then manually {@linkplain #refresh refreshed}.
*/
public AnnotationConfigApplicationContext() {
- this.delegateEnvironment(super.getEnvironment());
+ this.reader = new AnnotatedBeanDefinitionReader(this);
+ this.scanner = new ClassPathBeanDefinitionScanner(this);
}
/**
@@ -92,10 +93,6 @@ public AnnotationConfigApplicationContext(String... basePackages) {
@Override
public void setEnvironment(ConfigurableEnvironment environment) {
super.setEnvironment(environment);
- delegateEnvironment(environment);
- }
-
- private void delegateEnvironment(ConfigurableEnvironment environment) {
this.reader.setEnvironment(environment);
this.scanner.setEnvironment(environment);
} | true |
Other | spring-projects | spring-framework | 91f05c8b9d4e108e744484d808564a95b618e731.json | Avoid creation of unnecessary Environment objects
Prior to this change, any instantiation of an
AnnotationConfigApplicationContext would trigger the creation of three
StandardEnvironment objects: one for the ApplicationContext, one for the
AnnotatedBeanDefinitionReader, and one for the
ClassPathBeanDefinitionScanner.
The latter two are immediately swapped out when the ApplicationContext
delegates its environment to these subordinate objects anyway. Not only
is it inefficient to create these two extra Environments, it creates
confusion when debug-level logging is turned on. From the user's
perspective and in practice, there is only one Environment; logging
should reflect that.
This change ensures that only one Environment object is ever created for
a given ApplicationContext. If an AnnotatedBeanDefinitionReader or
ClassPathBeanDefinitionScanner are used in isolation, e.g. against a
plain BeanFactory/BeanDefinitionRegistry, then they will still create
their own local StandardEnvironment object.
All public API compatibility is preserved; new constructors have been
added where necessary to accommodate passing an Environment directly
to ABDR ar CPBDS. | org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathBeanDefinitionScanner.java | @@ -27,15 +27,17 @@
import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
+import org.springframework.core.env.Environment;
import org.springframework.core.env.EnvironmentCapable;
+import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.ResourceLoader;
import org.springframework.util.Assert;
import org.springframework.util.PatternMatchUtils;
/**
* A bean definition scanner that detects bean candidates on the classpath,
- * registering corresponding bean definitions with a given registry (BeanFactory
- * or ApplicationContext).
+ * registering corresponding bean definitions with a given registry ({@code BeanFactory}
+ * or {@code ApplicationContext}).
*
* <p>Candidate classes are detected through configurable type filters. The
* default filters include classes that are annotated with Spring's
@@ -73,29 +75,30 @@ public class ClassPathBeanDefinitionScanner extends ClassPathScanningCandidateCo
/**
- * Create a new ClassPathBeanDefinitionScanner for the given bean factory.
- * @param registry the BeanFactory to load bean definitions into,
- * in the form of a BeanDefinitionRegistry
+ * Create a new {@code ClassPathBeanDefinitionScanner} for the given bean factory.
+ * @param registry the {@code BeanFactory} to load bean definitions into, in the form
+ * of a {@code BeanDefinitionRegistry}
*/
public ClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry) {
this(registry, true);
}
/**
- * Create a new ClassPathBeanDefinitionScanner for the given bean factory.
- * <p>If the passed-in bean factory does not only implement the BeanDefinitionRegistry
- * interface but also the ResourceLoader interface, it will be used as default
- * ResourceLoader as well. This will usually be the case for
- * {@link org.springframework.context.ApplicationContext} implementations.
- * <p>If given a plain BeanDefinitionRegistry, the default ResourceLoader will be a
- * {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver}.
+ * Create a new {@code ClassPathBeanDefinitionScanner} for the given bean factory.
+ * <p>If the passed-in bean factory does not only implement the
+ * {@code BeanDefinitionRegistry} interface but also the {@code ResourceLoader}
+ * interface, it will be used as default {@code ResourceLoader} as well. This will
+ * usually be the case for {@link org.springframework.context.ApplicationContext}
+ * implementations.
+ * <p>If given a plain {@code BeanDefinitionRegistry}, the default {@code ResourceLoader}
+ * will be a {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver}.
* <p>If the the passed-in bean factory also implements {@link EnvironmentCapable} its
* environment will be used by this reader. Otherwise, the reader will initialize and
* use a {@link org.springframework.core.env.StandardEnvironment}. All
- * ApplicationContext implementations are EnvironmentCapable, while normal BeanFactory
- * implementations are not.
- * @param registry the BeanFactory to load bean definitions into,
- * in the form of a BeanDefinitionRegistry
+ * {@code ApplicationContext} implementations are {@code EnvironmentCapable}, while
+ * normal {@code BeanFactory} implementations are not.
+ * @param registry the {@code BeanFactory} to load bean definitions into, in the form
+ * of a {@code BeanDefinitionRegistry}
* @param useDefaultFilters whether to include the default filters for the
* {@link org.springframework.stereotype.Component @Component},
* {@link org.springframework.stereotype.Repository @Repository},
@@ -106,7 +109,33 @@ public ClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry) {
* @see #setEnvironment
*/
public ClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry, boolean useDefaultFilters) {
- super(useDefaultFilters);
+ this(registry, useDefaultFilters, getOrCreateEnvironment(registry));
+ }
+
+ /**
+ * Create a new {@code ClassPathBeanDefinitionScanner} for the given bean factory and
+ * using the given {@link Environment} when evaluating bean definition profile metadata.
+ * <p>If the passed-in bean factory does not only implement the {@code
+ * BeanDefinitionRegistry} interface but also the {@link ResourceLoader} interface, it
+ * will be used as default {@code ResourceLoader} as well. This will usually be the
+ * case for {@link org.springframework.context.ApplicationContext} implementations.
+ * <p>If given a plain {@code BeanDefinitionRegistry}, the default {@code ResourceLoader}
+ * will be a {@link org.springframework.core.io.support.PathMatchingResourcePatternResolver}.
+ * @param registry the {@code BeanFactory} to load bean definitions into, in the form
+ * of a {@code BeanDefinitionRegistry}
+ * @param useDefaultFilters whether to include the default filters for the
+ * @param environment the Spring {@link Environment} to use when evaluating bean
+ * definition profile metadata.
+ * {@link org.springframework.stereotype.Component @Component},
+ * {@link org.springframework.stereotype.Repository @Repository},
+ * {@link org.springframework.stereotype.Service @Service}, and
+ * {@link org.springframework.stereotype.Controller @Controller} stereotype
+ * annotations.
+ * @since 3.1
+ * @see #setResourceLoader
+ */
+ public ClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry, boolean useDefaultFilters, Environment environment) {
+ super(useDefaultFilters, environment);
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
this.registry = registry;
@@ -115,11 +144,6 @@ public ClassPathBeanDefinitionScanner(BeanDefinitionRegistry registry, boolean u
if (this.registry instanceof ResourceLoader) {
setResourceLoader((ResourceLoader) this.registry);
}
-
- // Inherit Environment if possible
- if (this.registry instanceof EnvironmentCapable) {
- setEnvironment(((EnvironmentCapable) this.registry).getEnvironment());
- }
}
@@ -307,4 +331,17 @@ protected boolean isCompatible(BeanDefinition newDefinition, BeanDefinition exis
newDefinition.equals(existingDefinition)); // scanned equivalent class twice
}
+
+ /**
+ * Get the Environment from the given registry if possible, otherwise return a new
+ * StandardEnvironment.
+ */
+ private static Environment getOrCreateEnvironment(BeanDefinitionRegistry registry) {
+ Assert.notNull(registry, "BeanDefinitionRegistry must not be null");
+ if (registry instanceof EnvironmentCapable) {
+ return ((EnvironmentCapable) registry).getEnvironment();
+ }
+ return new StandardEnvironment();
+ }
+
} | true |
Other | spring-projects | spring-framework | 91f05c8b9d4e108e744484d808564a95b618e731.json | Avoid creation of unnecessary Environment objects
Prior to this change, any instantiation of an
AnnotationConfigApplicationContext would trigger the creation of three
StandardEnvironment objects: one for the ApplicationContext, one for the
AnnotatedBeanDefinitionReader, and one for the
ClassPathBeanDefinitionScanner.
The latter two are immediately swapped out when the ApplicationContext
delegates its environment to these subordinate objects anyway. Not only
is it inefficient to create these two extra Environments, it creates
confusion when debug-level logging is turned on. From the user's
perspective and in practice, there is only one Environment; logging
should reflect that.
This change ensures that only one Environment object is ever created for
a given ApplicationContext. If an AnnotatedBeanDefinitionReader or
ClassPathBeanDefinitionScanner are used in isolation, e.g. against a
plain BeanFactory/BeanDefinitionRegistry, then they will still create
their own local StandardEnvironment object.
All public API compatibility is preserved; new constructors have been
added where necessary to accommodate passing an Environment directly
to ABDR ar CPBDS. | org.springframework.context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java | @@ -73,7 +73,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
protected final Log logger = LogFactory.getLog(getClass());
- private Environment environment = new StandardEnvironment();
+ private Environment environment;
private ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
@@ -95,9 +95,14 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
* @see #registerDefaultFilters()
*/
public ClassPathScanningCandidateComponentProvider(boolean useDefaultFilters) {
+ this(useDefaultFilters, new StandardEnvironment());
+ }
+
+ public ClassPathScanningCandidateComponentProvider(boolean useDefaultFilters, Environment environment) {
if (useDefaultFilters) {
registerDefaultFilters();
}
+ this.environment = environment;
}
| true |
Other | spring-projects | spring-framework | 549c663fbaee8fa610ef03ad26aab956fc350206.json | Fix generics warnings in AbstractBeanFactory | org.springframework.beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanFactory.java | @@ -136,8 +136,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
private TypeConverter typeConverter;
/** Custom PropertyEditors to apply to the beans of this factory */
- private final Map<Class, Class<? extends PropertyEditor>> customEditors =
- new HashMap<Class, Class<? extends PropertyEditor>>(4);
+ private final Map<Class<?>, Class<? extends PropertyEditor>> customEditors =
+ new HashMap<Class<?>, Class<? extends PropertyEditor>>(4);
/** String resolvers to apply e.g. to annotation attribute values */
private final List<StringValueResolver> embeddedValueResolvers = new LinkedList<StringValueResolver>();
@@ -288,7 +288,7 @@ protected <T> T doGetBean(
// Create bean instance.
if (mbd.isSingleton()) {
- sharedInstance = getSingleton(beanName, new ObjectFactory() {
+ sharedInstance = getSingleton(beanName, new ObjectFactory<Object>() {
public Object getObject() throws BeansException {
try {
return createBean(beanName, mbd, args);
@@ -325,7 +325,7 @@ else if (mbd.isPrototype()) {
throw new IllegalStateException("No Scope registered for scope '" + scopeName + "'");
}
try {
- Object scopedInstance = scope.get(beanName, new ObjectFactory() {
+ Object scopedInstance = scope.get(beanName, new ObjectFactory<Object>() {
public Object getObject() throws BeansException {
beforePrototypeCreation(beanName);
try {
@@ -379,7 +379,7 @@ public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
Object beanInstance = getSingleton(beanName, false);
if (beanInstance != null) {
if (beanInstance instanceof FactoryBean) {
- return (BeanFactoryUtils.isFactoryDereference(name) || ((FactoryBean) beanInstance).isSingleton());
+ return (BeanFactoryUtils.isFactoryDereference(name) || ((FactoryBean<?>) beanInstance).isSingleton());
}
else {
return !BeanFactoryUtils.isFactoryDereference(name);
@@ -405,7 +405,7 @@ else if (containsSingleton(beanName)) {
if (BeanFactoryUtils.isFactoryDereference(name)) {
return true;
}
- FactoryBean factoryBean = (FactoryBean) getBean(FACTORY_BEAN_PREFIX + beanName);
+ FactoryBean<?> factoryBean = (FactoryBean<?>) getBean(FACTORY_BEAN_PREFIX + beanName);
return factoryBean.isSingleton();
}
else {
@@ -439,17 +439,17 @@ public boolean isPrototype(String name) throws NoSuchBeanDefinitionException {
return false;
}
if (isFactoryBean(beanName, mbd)) {
- final FactoryBean factoryBean = (FactoryBean) getBean(FACTORY_BEAN_PREFIX + beanName);
+ final FactoryBean<?> factoryBean = (FactoryBean<?>) getBean(FACTORY_BEAN_PREFIX + beanName);
if (System.getSecurityManager() != null) {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
- return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean) factoryBean).isPrototype()) ||
+ return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean<?>) factoryBean).isPrototype()) ||
!factoryBean.isSingleton());
}
}, getAccessControlContext());
}
else {
- return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean) factoryBean).isPrototype()) ||
+ return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean<?>) factoryBean).isPrototype()) ||
!factoryBean.isSingleton());
}
}
@@ -459,16 +459,16 @@ public Boolean run() {
}
}
- public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
+ public boolean isTypeMatch(String name, Class<?> targetType) throws NoSuchBeanDefinitionException {
String beanName = transformedBeanName(name);
- Class typeToMatch = (targetType != null ? targetType : Object.class);
+ Class<?> typeToMatch = (targetType != null ? targetType : Object.class);
// Check manually registered singletons.
Object beanInstance = getSingleton(beanName, false);
if (beanInstance != null) {
if (beanInstance instanceof FactoryBean) {
if (!BeanFactoryUtils.isFactoryDereference(name)) {
- Class type = getTypeForFactoryBean((FactoryBean) beanInstance);
+ Class<?> type = getTypeForFactoryBean((FactoryBean<?>) beanInstance);
return (type != null && ClassUtils.isAssignable(typeToMatch, type));
}
else {
@@ -501,13 +501,13 @@ else if (containsSingleton(beanName) && !containsBeanDefinition(beanName)) {
BeanDefinitionHolder dbd = mbd.getDecoratedDefinition();
if (dbd != null && !BeanFactoryUtils.isFactoryDereference(name)) {
RootBeanDefinition tbd = getMergedBeanDefinition(dbd.getBeanName(), dbd.getBeanDefinition(), mbd);
- Class targetClass = predictBeanType(dbd.getBeanName(), tbd, FactoryBean.class, typeToMatch);
+ Class<?> targetClass = predictBeanType(dbd.getBeanName(), tbd, FactoryBean.class, typeToMatch);
if (targetClass != null && !FactoryBean.class.isAssignableFrom(targetClass)) {
return typeToMatch.isAssignableFrom(targetClass);
}
}
- Class beanClass = predictBeanType(beanName, mbd, FactoryBean.class, typeToMatch);
+ Class<?> beanClass = predictBeanType(beanName, mbd, FactoryBean.class, typeToMatch);
if (beanClass == null) {
return false;
}
@@ -516,7 +516,7 @@ else if (containsSingleton(beanName) && !containsBeanDefinition(beanName)) {
if (FactoryBean.class.isAssignableFrom(beanClass)) {
if (!BeanFactoryUtils.isFactoryDereference(name)) {
// If it's a FactoryBean, we want to look at what it creates, not the factory class.
- Class type = getTypeForFactoryBean(beanName, mbd);
+ Class<?> type = getTypeForFactoryBean(beanName, mbd);
return (type != null && typeToMatch.isAssignableFrom(type));
}
else {
@@ -537,7 +537,7 @@ public Class<?> getType(String name) throws NoSuchBeanDefinitionException {
Object beanInstance = getSingleton(beanName, false);
if (beanInstance != null) {
if (beanInstance instanceof FactoryBean && !BeanFactoryUtils.isFactoryDereference(name)) {
- return getTypeForFactoryBean((FactoryBean) beanInstance);
+ return getTypeForFactoryBean((FactoryBean<?>) beanInstance);
}
else {
return beanInstance.getClass();
@@ -563,13 +563,13 @@ else if (containsSingleton(beanName) && !containsBeanDefinition(beanName)) {
BeanDefinitionHolder dbd = mbd.getDecoratedDefinition();
if (dbd != null && !BeanFactoryUtils.isFactoryDereference(name)) {
RootBeanDefinition tbd = getMergedBeanDefinition(dbd.getBeanName(), dbd.getBeanDefinition(), mbd);
- Class targetClass = predictBeanType(dbd.getBeanName(), tbd);
+ Class<?> targetClass = predictBeanType(dbd.getBeanName(), tbd);
if (targetClass != null && !FactoryBean.class.isAssignableFrom(targetClass)) {
return targetClass;
}
}
- Class beanClass = predictBeanType(beanName, mbd);
+ Class<?> beanClass = predictBeanType(beanName, mbd);
// Check bean class whether we're dealing with a FactoryBean.
if (beanClass != null && FactoryBean.class.isAssignableFrom(beanClass)) {
@@ -707,7 +707,7 @@ public void copyRegisteredEditorsTo(PropertyEditorRegistry registry) {
/**
* Return the map of custom editors, with Classes as keys and PropertyEditor classes as values.
*/
- public Map<Class, Class<? extends PropertyEditor>> getCustomEditors() {
+ public Map<Class<?>, Class<? extends PropertyEditor>> getCustomEditors() {
return this.customEditors;
}
@@ -950,7 +950,7 @@ else if (curVal instanceof Set) {
protected final boolean isPrototypeCurrentlyInCreation(String beanName) {
Object curVal = this.prototypesCurrentlyInCreation.get();
return (curVal != null &&
- (curVal.equals(beanName) || (curVal instanceof Set && ((Set) curVal).contains(beanName))));
+ (curVal.equals(beanName) || (curVal instanceof Set && ((Set<?>) curVal).contains(beanName))));
}
public boolean isCurrentlyInCreation(String beanName) {
@@ -1069,8 +1069,8 @@ protected void registerCustomEditors(PropertyEditorRegistry registry) {
}
}
if (!this.customEditors.isEmpty()) {
- for (Map.Entry<Class, Class<? extends PropertyEditor>> entry : this.customEditors.entrySet()) {
- Class requiredType = entry.getKey();
+ for (Map.Entry<Class<?>, Class<? extends PropertyEditor>> entry : this.customEditors.entrySet()) {
+ Class<?> requiredType = entry.getKey();
Class<? extends PropertyEditor> editorClass = entry.getValue();
registry.registerCustomEditor(requiredType, BeanUtils.instantiateClass(editorClass));
}
@@ -1237,15 +1237,15 @@ protected void clearMergedBeanDefinition(String beanName) {
* @return the resolved bean class (or <code>null</code> if none)
* @throws CannotLoadBeanClassException if we failed to load the class
*/
- protected Class resolveBeanClass(final RootBeanDefinition mbd, String beanName, final Class... typesToMatch)
+ protected Class<?> resolveBeanClass(final RootBeanDefinition mbd, String beanName, final Class<?>... typesToMatch)
throws CannotLoadBeanClassException {
try {
if (mbd.hasBeanClass()) {
return mbd.getBeanClass();
}
if (System.getSecurityManager() != null) {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<Class>() {
- public Class run() throws Exception {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
+ public Class<?> run() throws Exception {
return doResolveBeanClass(mbd, typesToMatch);
}
}, getAccessControlContext());
@@ -1266,7 +1266,7 @@ public Class run() throws Exception {
}
}
- private Class doResolveBeanClass(RootBeanDefinition mbd, Class... typesToMatch) throws ClassNotFoundException {
+ private Class<?> doResolveBeanClass(RootBeanDefinition mbd, Class<?>... typesToMatch) throws ClassNotFoundException {
if (!ObjectUtils.isEmpty(typesToMatch)) {
ClassLoader tempClassLoader = getTempClassLoader();
if (tempClassLoader != null) {
@@ -1315,7 +1315,7 @@ protected Object evaluateBeanDefinitionString(String value, BeanDefinition beanD
* (also signals that the returned <code>Class</code> will never be exposed to application code)
* @return the type of the bean, or <code>null</code> if not predictable
*/
- protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class... typesToMatch) {
+ protected Class<?> predictBeanType(String beanName, RootBeanDefinition mbd, Class<?>... typesToMatch) {
if (mbd.getFactoryMethodName() != null) {
return null;
}
@@ -1328,7 +1328,7 @@ protected Class predictBeanType(String beanName, RootBeanDefinition mbd, Class..
* @param mbd the corresponding bean definition
*/
protected boolean isFactoryBean(String beanName, RootBeanDefinition mbd) {
- Class beanClass = predictBeanType(beanName, mbd, FactoryBean.class);
+ Class<?> beanClass = predictBeanType(beanName, mbd, FactoryBean.class);
return (beanClass != null && FactoryBean.class.isAssignableFrom(beanClass));
}
@@ -1347,12 +1347,12 @@ protected boolean isFactoryBean(String beanName, RootBeanDefinition mbd) {
* @see org.springframework.beans.factory.FactoryBean#getObjectType()
* @see #getBean(String)
*/
- protected Class getTypeForFactoryBean(String beanName, RootBeanDefinition mbd) {
+ protected Class<?> getTypeForFactoryBean(String beanName, RootBeanDefinition mbd) {
if (!mbd.isSingleton()) {
return null;
}
try {
- FactoryBean factoryBean = doGetBean(FACTORY_BEAN_PREFIX + beanName, FactoryBean.class, null, true);
+ FactoryBean<?> factoryBean = doGetBean(FACTORY_BEAN_PREFIX + beanName, FactoryBean.class, null, true);
return getTypeForFactoryBean(factoryBean);
}
catch (BeanCreationException ex) {
@@ -1432,7 +1432,7 @@ protected Object getObjectForBeanInstance(
}
if (object == null) {
// Return bean instance from factory.
- FactoryBean factory = (FactoryBean) beanInstance;
+ FactoryBean<?> factory = (FactoryBean<?>) beanInstance;
// Caches object obtained from FactoryBean if it is a singleton.
if (mbd == null && containsBeanDefinition(beanName)) {
mbd = getMergedLocalBeanDefinition(beanName); | false |
Other | spring-projects | spring-framework | 01cc76f8e3b3016677cad5d7be8a45ee1f6bab2c.json | SPR-8697 Flag '*/subtype' as illegal. | org.springframework.web/src/main/java/org/springframework/http/MediaType.java | @@ -575,6 +575,9 @@ public static MediaType parseMediaType(String mediaType) {
}
String type = fullType.substring(0, subIndex);
String subtype = fullType.substring(subIndex + 1, fullType.length());
+ if (WILDCARD_TYPE.equals(type) && !WILDCARD_TYPE.equals(subtype)) {
+ throw new IllegalArgumentException("A wildcard type is legal only in '*/*' (all media types).");
+ }
Map<String, String> parameters = null;
if (parts.length > 1) { | true |
Other | spring-projects | spring-framework | 01cc76f8e3b3016677cad5d7be8a45ee1f6bab2c.json | SPR-8697 Flag '*/subtype' as illegal. | org.springframework.web/src/test/java/org/springframework/http/MediaTypeTests.java | @@ -128,6 +128,11 @@ public void parseMediaTypeNoSubtypeSlash() {
MediaType.parseMediaType("audio/");
}
+ @Test(expected = IllegalArgumentException.class)
+ public void parseMediaTypeTypeRange() {
+ MediaType.parseMediaType("*/json");
+ }
+
@Test(expected = IllegalArgumentException.class)
public void parseMediaTypeIllegalType() {
MediaType.parseMediaType("audio(/basic"); | true |
Other | spring-projects | spring-framework | 56608d6bd6ccae968eafa6840249a205b4f57e9d.json | Fix typo in ResourceHolder#isVoid Javadoc
Issue: SPR-8843 | org.springframework.transaction/src/main/java/org/springframework/transaction/support/ResourceHolder.java | @@ -39,7 +39,7 @@ public interface ResourceHolder {
void unbound();
/**
- * Determine whether this holder is considere as 'void',
+ * Determine whether this holder is considered as 'void',
* i.e. as a leftover from a previous thread.
*/
boolean isVoid(); | false |
Other | spring-projects | spring-framework | 1d5ca80924df154fd51fe9492f66e04a17958382.json | Fix typo in classpath scanning reference doc
Issue: SPR-8842 | spring-framework-reference/src/beans-classpath-scanning.xml | @@ -4,23 +4,21 @@
<section id="beans-classpath-scanning">
<title>Classpath scanning and managed components</title>
- <!-- MLP: Beverly to review paragraph -->
-
- <para>Most examples foo bar in this chapter use XML to specify the
- configuration metadata that produces each
- <interfacename>BeanDefinition</interfacename> within the Spring container.
- The previous section (<xref linkend="beans-annotation-config"/>)
- demonstrates how to provide a lot of the configuration metadata through
- source-level annotations. Even in those examples, however, the "base" bean
- definitions are explicitly defined in the XML file, while the annotations
- only drive the dependency injection. This section describes an option for
- implicitly detecting the <emphasis>candidate components</emphasis> by
- scanning the classpath. Candidate components are classes that match against
- a filter criteria and have a corresponding bean definition registered with
- the container. This removes the need to use XML to perform bean
- registration, instead you can use annotations (for example @Component),
- AspectJ type expressions, or your own custom filter criteria to select which
- classes will have bean definitions registered with the container.</para>
+ <para>Most examples in this chapter use XML to specify the configuration
+ metadata that produces each <interfacename>BeanDefinition</interfacename>
+ within the Spring container. The previous section
+ (<xref linkend="beans-annotation-config"/>) demonstrates how to provide a
+ lot of the configuration metadata through source-level annotations. Even
+ in those examples, however, the "base" bean definitions are explicitly
+ defined in the XML file, while the annotations only drive the dependency
+ injection. This section describes an option for implicitly detecting the
+ <emphasis>candidate components</emphasis> by scanning the classpath.
+ Candidate components are classes that match against a filter criteria and
+ have a corresponding bean definition registered with the container. This
+ removes the need to use XML to perform bean registration, instead you can
+ use annotations (for example @Component), AspectJ type expressions, or your
+ own custom filter criteria to select which classes will have bean
+ definitions registered with the container.</para>
<note>
<para>Starting with Spring 3.0, many features provided by the <ulink | false |
Other | spring-projects | spring-framework | 3528637d62bbcc685522714a4a826dca88346ae4.json | Fix JUnit version in spring-parent pom
Issue: SPR-8852 | org.springframework.spring-parent/pom.xml | @@ -44,7 +44,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.9.0</version>
+ <version>4.9</version>
<scope>test</scope>
</dependency>
<dependency> | false |
Other | spring-projects | spring-framework | 06306f91499db610fdef12bbd4ecd7790f5b9370.json | Extract various constants in DefaultKeyGenerator | org.springframework.context/src/main/java/org/springframework/cache/interceptor/DefaultKeyGenerator.java | @@ -21,25 +21,30 @@
import org.springframework.cache.interceptor.KeyGenerator;
/**
- * Default key generator. Returns 0 if no param is given, the param itself if
- * only one is given or a hash code computed from all given params hash code.
- * Uses a constant (53) for <code>null</code> objects.
+ * Default key generator. Returns {@value #NO_PARAM_KEY} if no parameters are provided,
+ * the parameter itself if only one is given or a hash code computed from all given
+ * parameters' hash code values. Uses the constant value {@value #NULL_PARAM_KEY} for any
+ * {@code null} parameters given.
*
* @author Costin Leau
+ * @author Chris Beams
* @since 3.1
*/
public class DefaultKeyGenerator implements KeyGenerator {
+ public static final int NO_PARAM_KEY = 0;
+ public static final int NULL_PARAM_KEY = 53;
+
public Object extract(Object target, Method method, Object... params) {
if (params.length == 1) {
- return (params[0] == null ? 53 : params[0]);
+ return (params[0] == null ? NULL_PARAM_KEY : params[0]);
}
if (params.length == 0) {
- return 0;
+ return NO_PARAM_KEY;
}
int hashCode = 17;
for (Object object : params) {
- hashCode = 31 * hashCode + (object == null ? 53 : object.hashCode());
+ hashCode = 31 * hashCode + (object == null ? NULL_PARAM_KEY : object.hashCode());
}
return Integer.valueOf(hashCode);
}
| false |
Other | spring-projects | spring-framework | 42cbee883fb07fdb05da80e5dc9119b8cef8cb8f.json | Add generics to AbstractCacheManager#caches
Facilitates type-safe programmatic configuration from @Bean methods:
@Bean
public CacheManager cacheManager() {
SimpleCacheManager cm = new SimpleCacheManager();
cm.setCaches(Arrays.asList(
new ConcurrentMapCache("default"),
new ConcurrentMapCache("primary"),
new ConcurrentMapCache("secondary")
));
return cm;
}
Prior to this change, the code above would have raised errors on the
Arrays.asList() call because it returns a Collection<? extends Cache>
as opposed to Collection<Cache>.
After this change, AbstractCacheManager expects
Collection<? extends Cache> throughout. | org.springframework.context/src/main/java/org/springframework/cache/support/AbstractCacheManager.java | @@ -44,7 +44,7 @@ public abstract class AbstractCacheManager implements CacheManager, Initializing
public void afterPropertiesSet() {
- Collection<Cache> caches = loadCaches();
+ Collection<? extends Cache> caches = loadCaches();
Assert.notEmpty(caches, "loadCaches must not return an empty Collection");
this.cacheMap.clear();
@@ -73,6 +73,6 @@ public Collection<String> getCacheNames() {
* Load the caches for this cache manager. Occurs at startup.
* The returned collection must not be null.
*/
- protected abstract Collection<Cache> loadCaches();
+ protected abstract Collection<? extends Cache> loadCaches();
}
| true |
Other | spring-projects | spring-framework | 42cbee883fb07fdb05da80e5dc9119b8cef8cb8f.json | Add generics to AbstractCacheManager#caches
Facilitates type-safe programmatic configuration from @Bean methods:
@Bean
public CacheManager cacheManager() {
SimpleCacheManager cm = new SimpleCacheManager();
cm.setCaches(Arrays.asList(
new ConcurrentMapCache("default"),
new ConcurrentMapCache("primary"),
new ConcurrentMapCache("secondary")
));
return cm;
}
Prior to this change, the code above would have raised errors on the
Arrays.asList() call because it returns a Collection<? extends Cache>
as opposed to Collection<Cache>.
After this change, AbstractCacheManager expects
Collection<? extends Cache> throughout. | org.springframework.context/src/main/java/org/springframework/cache/support/SimpleCacheManager.java | @@ -29,17 +29,17 @@
*/
public class SimpleCacheManager extends AbstractCacheManager {
- private Collection<Cache> caches;
+ private Collection<? extends Cache> caches;
/**
* Specify the collection of Cache instances to use for this CacheManager.
*/
- public void setCaches(Collection<Cache> caches) {
+ public void setCaches(Collection<? extends Cache> caches) {
this.caches = caches;
}
@Override
- protected Collection<Cache> loadCaches() {
+ protected Collection<? extends Cache> loadCaches() {
return this.caches;
}
| true |
Other | spring-projects | spring-framework | 8abb3150420d03e7c8cd3f483bf8a411e6fbcc0e.json | Fix cache generics warnings; polish whitespace | org.springframework.context/src/test/java/org/springframework/cache/config/AbstractAnnotationTests.java | @@ -31,16 +31,16 @@
/**
* Abstract annotation test (containing several reusable methods).
- *
+ *
* @author Costin Leau
*/
public abstract class AbstractAnnotationTests {
protected ApplicationContext ctx;
- protected CacheableService cs;
+ protected CacheableService<?> cs;
- protected CacheableService ccs;
+ protected CacheableService<?> ccs;
protected CacheManager cm;
@@ -58,9 +58,8 @@ public void setup() {
assertTrue(cn.contains("primary"));
}
- public void testCacheable(CacheableService service) throws Exception {
+ public void testCacheable(CacheableService<?> service) throws Exception {
Object o1 = new Object();
- Object o2 = new Object();
Object r1 = service.cache(o1);
Object r2 = service.cache(o1);
@@ -70,9 +69,8 @@ public void testCacheable(CacheableService service) throws Exception {
assertSame(r1, r3);
}
- public void testInvalidate(CacheableService service) throws Exception {
+ public void testInvalidate(CacheableService<?> service) throws Exception {
Object o1 = new Object();
- Object o2 = new Object();
Object r1 = service.cache(o1);
Object r2 = service.cache(o1);
@@ -85,9 +83,8 @@ public void testInvalidate(CacheableService service) throws Exception {
assertSame(r3, r4);
}
- public void testInvalidateWKey(CacheableService service) throws Exception {
+ public void testInvalidateWKey(CacheableService<?> service) throws Exception {
Object o1 = new Object();
- Object o2 = new Object();
Object r1 = service.cache(o1);
Object r2 = service.cache(o1);
@@ -100,7 +97,7 @@ public void testInvalidateWKey(CacheableService service) throws Exception {
assertSame(r3, r4);
}
- public void testConditionalExpression(CacheableService service)
+ public void testConditionalExpression(CacheableService<?> service)
throws Exception {
Object r1 = service.conditional(4);
Object r2 = service.conditional(4);
@@ -113,7 +110,7 @@ public void testConditionalExpression(CacheableService service)
assertSame(r3, r4);
}
- public void testKeyExpression(CacheableService service) throws Exception {
+ public void testKeyExpression(CacheableService<?> service) throws Exception {
Object r1 = service.key(5, 1);
Object r2 = service.key(5, 2);
@@ -125,7 +122,7 @@ public void testKeyExpression(CacheableService service) throws Exception {
assertNotSame(r3, r4);
}
- public void testNullValue(CacheableService service) throws Exception {
+ public void testNullValue(CacheableService<?> service) throws Exception {
Object key = new Object();
assertNull(service.nullValue(key));
int nr = service.nullInvocations().intValue();
@@ -135,7 +132,7 @@ public void testNullValue(CacheableService service) throws Exception {
assertEquals(nr + 1, service.nullInvocations().intValue());
}
- public void testMethodName(CacheableService service, String keyName)
+ public void testMethodName(CacheableService<?> service, String keyName)
throws Exception {
Object key = new Object();
Object r1 = service.name(key);
@@ -145,7 +142,7 @@ public void testMethodName(CacheableService service, String keyName)
assertNotNull(cache.get(keyName));
}
- public void testRootVars(CacheableService service) {
+ public void testRootVars(CacheableService<?> service) {
Object key = new Object();
Object r1 = service.rootVars(key);
assertSame(r1, service.rootVars(key));
@@ -155,7 +152,7 @@ public void testRootVars(CacheableService service) {
assertNotNull(cache.get(expectedKey));
}
- public void testCheckedThrowable(CacheableService service) throws Exception {
+ public void testCheckedThrowable(CacheableService<?> service) throws Exception {
String arg = UUID.randomUUID().toString();
try {
service.throwChecked(arg);
@@ -165,7 +162,7 @@ public void testCheckedThrowable(CacheableService service) throws Exception {
}
}
- public void testUncheckedThrowable(CacheableService service) throws Exception {
+ public void testUncheckedThrowable(CacheableService<?> service) throws Exception {
try {
service.throwUnchecked(Long.valueOf(1));
fail("Excepted exception");
@@ -176,12 +173,12 @@ public void testUncheckedThrowable(CacheableService service) throws Exception {
}
}
- public void testNullArg(CacheableService service) {
+ public void testNullArg(CacheableService<?> service) {
Object r1 = service.cache(null);
assertSame(r1, service.cache(null));
}
- public void testCacheUpdate(CacheableService service) {
+ public void testCacheUpdate(CacheableService<?> service) {
Object o = new Object();
Cache cache = cm.getCache("default");
assertNull(cache.get(o));
@@ -194,7 +191,7 @@ public void testCacheUpdate(CacheableService service) {
assertSame(r2, cache.get(o).get());
}
- public void testConditionalCacheUpdate(CacheableService service) {
+ public void testConditionalCacheUpdate(CacheableService<?> service) {
Integer one = Integer.valueOf(1);
Integer three = Integer.valueOf(3);
@@ -206,7 +203,7 @@ public void testConditionalCacheUpdate(CacheableService service) {
assertEquals(three, Integer.valueOf(cache.get(three).get().toString()));
}
- public void testMultiCache(CacheableService service) {
+ public void testMultiCache(CacheableService<?> service) {
Object o1 = new Object();
Object o2 = new Object();
@@ -232,7 +229,7 @@ public void testMultiCache(CacheableService service) {
assertSame(r4, secondary.get(o2).get());
}
- public void testMultiEvict(CacheableService service) {
+ public void testMultiEvict(CacheableService<?> service) {
Object o1 = new Object();
Object r1 = service.multiCache(o1);
@@ -258,7 +255,7 @@ public void testMultiEvict(CacheableService service) {
assertSame(r4, secondary.get(o1).get());
}
- public void testMultiPut(CacheableService service) {
+ public void testMultiPut(CacheableService<?> service) {
Object o = Integer.valueOf(1);
Cache primary = cm.getCache("primary");
@@ -278,7 +275,7 @@ public void testMultiPut(CacheableService service) {
assertSame(r2, secondary.get(o).get());
}
- public void testMultiCacheAndEvict(CacheableService service) {
+ public void testMultiCacheAndEvict(CacheableService<?> service) {
String methodName = "multiCacheAndEvict";
Cache primary = cm.getCache("primary");
@@ -299,7 +296,7 @@ public void testMultiCacheAndEvict(CacheableService service) {
assertNull(secondary.get(key));
}
- public void testMultiConditionalCacheAndEvict(CacheableService service) {
+ public void testMultiConditionalCacheAndEvict(CacheableService<?> service) {
Cache primary = cm.getCache("primary");
Cache secondary = cm.getCache("secondary");
Object key = Integer.valueOf(1);
| true |
Other | spring-projects | spring-framework | 8abb3150420d03e7c8cd3f483bf8a411e6fbcc0e.json | Fix cache generics warnings; polish whitespace | org.springframework.context/src/test/java/org/springframework/cache/config/AnnotatedClassCacheableService.java | @@ -27,7 +27,7 @@
* @author Costin Leau
*/
@Cacheable("default")
-public class AnnotatedClassCacheableService implements CacheableService {
+public class AnnotatedClassCacheableService implements CacheableService<Object> {
private final AtomicLong counter = new AtomicLong();
public static final AtomicLong nullInvocations = new AtomicLong();
| true |
Other | spring-projects | spring-framework | 8abb3150420d03e7c8cd3f483bf8a411e6fbcc0e.json | Fix cache generics warnings; polish whitespace | org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationNamespaceDrivenTests.java | @@ -21,7 +21,6 @@
import org.junit.Test;
import org.springframework.cache.interceptor.CacheInterceptor;
-
/**
* @author Costin Leau
*/
| true |
Other | spring-projects | spring-framework | 8abb3150420d03e7c8cd3f483bf8a411e6fbcc0e.json | Fix cache generics warnings; polish whitespace | org.springframework.context/src/test/java/org/springframework/cache/config/AnnotationTests.java | @@ -16,8 +16,6 @@
package org.springframework.cache.config;
-
-
/**
* @author Costin Leau
*/
| true |
Other | spring-projects | spring-framework | 8abb3150420d03e7c8cd3f483bf8a411e6fbcc0e.json | Fix cache generics warnings; polish whitespace | org.springframework.context/src/test/java/org/springframework/cache/config/CacheAdviceNamespaceTests.java | @@ -20,13 +20,11 @@
import org.junit.Test;
import org.springframework.cache.interceptor.CacheInterceptor;
-
/**
* @author Costin Leau
*/
public class CacheAdviceNamespaceTests extends AbstractAnnotationTests {
-
@Override
protected String getConfig() {
return "/org/springframework/cache/config/cache-advice.xml";
| true |
Other | spring-projects | spring-framework | 8abb3150420d03e7c8cd3f483bf8a411e6fbcc0e.json | Fix cache generics warnings; polish whitespace | org.springframework.context/src/test/java/org/springframework/cache/config/CacheableService.java | @@ -16,7 +16,6 @@
package org.springframework.cache.config;
-
/**
* Basic service interface.
*
| true |
Other | spring-projects | spring-framework | 40798bd48f63a8f0d9c6529ca6aaa7203b95cbc3.json | Improve ImportStack#toString output | org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java | @@ -248,14 +248,22 @@ private void processImport(ConfigurationClass configClass, String[] classesToImp
// the candidate class is an ImportSelector -> delegate to it to determine imports
try {
ImportSelector selector = BeanUtils.instantiateClass(Class.forName(candidate), ImportSelector.class);
- ImportSelectorContext context = new ImportSelectorContext(importingClassMetadata, this.registry);
- processImport(configClass, selector.selectImports(context), false);
+ processImport(configClass, selector.selectImports(importingClassMetadata), false);
+ } catch (ClassNotFoundException ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+ else if (new AssignableTypeFilter(ImportBeanDefinitionRegistrar.class).match(reader, metadataReaderFactory)) {
+ // the candidate class is an ImportBeanDefinitionRegistrar -> delegate to it to register additional bean definitions
+ try {
+ ImportBeanDefinitionRegistrar registrar = BeanUtils.instantiateClass(Class.forName(candidate), ImportBeanDefinitionRegistrar.class);
+ registrar.registerBeanDefinitions(importingClassMetadata, registry);
} catch (ClassNotFoundException ex) {
throw new IllegalStateException(ex);
}
}
else {
- // the candidate class not an ImportSelector -> process it as a @Configuration class
+ // the candidate class not an ImportSelector or ImportBeanDefinitionRegistrar -> process it as a @Configuration class
this.importStack.registerImport(importingClassMetadata.getClassName(), candidate);
processConfigurationClass(new ConfigurationClass(reader, null));
}
@@ -323,24 +331,24 @@ public int compare(ConfigurationClass first, ConfigurationClass second) {
/**
* Given a stack containing (in order)
- * <ol>
+ * <ul>
* <li>com.acme.Foo</li>
* <li>com.acme.Bar</li>
* <li>com.acme.Baz</li>
- * </ol>
- * Returns "Foo->Bar->Baz". In the case of an empty stack, returns empty string.
+ * </ul>
+ * return "ImportStack: [Foo->Bar->Baz]".
*/
@Override
public String toString() {
- StringBuilder builder = new StringBuilder();
+ StringBuilder builder = new StringBuilder("ImportStack: [");
Iterator<ConfigurationClass> iterator = iterator();
while (iterator.hasNext()) {
builder.append(iterator.next().getSimpleName());
if (iterator.hasNext()) {
builder.append("->");
}
}
- return builder.toString();
+ return builder.append(']').toString();
}
}
| false |
Other | spring-projects | spring-framework | 4ededaf11c933f760f741f3dd311dc3e1e418af4.json | Fix typo in DateTimeFormat Javadoc
Issue: SPR-8838 | org.springframework.context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java | @@ -33,7 +33,7 @@
* <p>
* For ISO-based formatting, set the {@link #iso()} attribute to be the desired {@link ISO} format, such as {@link ISO#DATE}.
<p>
- * For custom formatting, set the {@link #pattern()} attribute to be the DateTime pattern, such as <code>yyyy/mm/dd h:mm:ss a</code>.
+ * For custom formatting, set the {@link #pattern()} attribute to be the DateTime pattern, such as <code>yyyy/MM/dd hh:mm:ss a</code>.
* <p>
* Each attribute is mutually exclusive, so only set one attribute per annotation instance (the one most convenient one for your formatting needs).
* When the pattern attribute is specified, it takes precedence over both the style and ISO attribute. | false |
Other | spring-projects | spring-framework | ccf3732cd8c8ecf3918d610c31e48ee71d45b9ff.json | Create import-into-eclipse.bat for Windows users
Port import-into-eclipse.sh to a Windows batch file. | import-into-eclipse.bat | @@ -0,0 +1,117 @@
+@echo off
+set STS_TEST_VERSION='2.9.2.RELEASE'
+
+set CURRENT_DIR=%~dp0
+cd %CURRENT_DIR%
+
+cls
+
+echo.
+echo -----------------------------------------------------------------------
+echo Spring Framework Eclipse/STS project import guide
+echo.
+echo This script will guide you through the process of importing the
+echo Spring Framework sources into Eclipse/STS. It is recommended that you
+echo have a recent version of the SpringSource Tool Suite (this script has
+echo been tested against STS %STS_TEST_VERSION%), but at the minimum you will
+echo need Eclipse + AJDT.
+echo.
+echo If you need to download and install STS, please do that now by
+echo visiting http://springsource.org/downloads/sts
+echo.
+echo Otherwise, press enter and we'll begin.
+
+pause
+
+REM this command:
+REM - wipes out any existing Eclipse metadata
+REM - generates OXM test classes to avoid errors on import into Eclipse
+REM - generates metadata for all subprojects
+REM - skips metadata gen for the root project (-x :eclipse) to work
+REM around Eclipse's inability to import hierarchical project structures
+REM SET COMMAND="./gradlew cleanEclipse :spring-oxm:compileTestJava eclipse -x :eclipse"
+SET COMMAND=gradlew cleanEclipse :spring-oxm:compileTestJava eclipse -x :eclipse
+
+echo.
+echo -----------------------------------------------------------------------
+echo STEP 1: Generate subproject Eclipse metadata
+echo.
+echo The first step will be to generate Eclipse project metadata for each
+echo of the spring-* subprojects. This happens via the built-in
+echo "Gradle wrapper" script (./gradlew in this directory). If this is your
+echo first time using the Gradle wrapper, this step may take a few minutes
+echo while a Gradle distribution is downloaded for you.
+echo.
+echo The command run will be:
+echo.
+echo %COMMAND%
+echo.
+echo Press enter when ready.
+
+pause
+
+call %COMMAND%
+if not "%ERRORLEVEL%" == "0" exit /B %ERRORLEVEL%
+
+echo.
+echo -----------------------------------------------------------------------
+echo STEP 2: Import subprojects into Eclipse/STS
+echo.
+echo Within Eclipse/STS, do the following:
+echo.
+echo File ^> Import... ^> Existing Projects into Workspace
+echo ^> When prompted for the 'root directory', provide %CURRENT_DIR%
+echo ^> Press enter. You will see the modules show up under "Projects"
+echo ^> All projects should be selected/checked. Click Finish.
+echo ^> When the project import is complete, you should have no errors.
+echo.
+echo When the above is complete, return here and press the enter key.
+
+pause
+
+set COMMAND=gradlew :eclipse
+
+echo.
+echo -----------------------------------------------------------------------
+echo STEP 3: generate root project Eclipse metadata
+echo.
+echo Unfortunately, Eclipse does not allow for importing project
+echo hierarchies, so we had to skip root project metadata generation in the
+echo during step 1. In this step we simply generate root project metadata
+echo so you can import it in the next step.
+echo.
+echo The command run will be:
+echo.
+echo %COMMAND%
+echo.
+echo Press the enter key when ready.
+pause
+
+call %COMMAND%
+if not "%ERRORLEVEL%" == "0" exit /B %ERRORLEVEL%
+
+echo.
+echo -----------------------------------------------------------------------
+echo STEP 4: Import root project into Eclipse/STS
+echo.
+echo Follow the project import steps listed in step 2 above to import the
+echo root project.
+echo.
+echo Press enter when complete, and move on to the final step.
+
+pause
+
+echo.
+echo -----------------------------------------------------------------------
+echo STEP 5: Enable Git support for all projects
+echo.
+echo - In the Eclipse/STS Package Explorer, select all spring* projects.
+echo - Right-click to open the context menu and select Team ^> Share Project...
+echo - In the Share Project dialog that appears, select Git and press Next
+echo - Check "Use or create repository in parent folder of project"
+echo - Click Finish
+echo.
+echo When complete, you'll have Git support enabled for all projects.
+echo.
+echo You're ready to code! Goodbye!
+
| false |
Other | spring-projects | spring-framework | 38cf91922c0423fa8ffd541e9cc7f1d2cae87529.json | Fix intermittent test failure in AsyncTests | spring-test-mvc/src/main/java/org/springframework/test/web/servlet/DefaultMvcResult.java | @@ -22,8 +22,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.web.context.request.async.WebAsyncManager;
-import org.springframework.web.context.request.async.WebAsyncUtils;
import org.springframework.web.servlet.FlashMap;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
@@ -50,6 +48,8 @@ class DefaultMvcResult implements MvcResult {
private Exception resolvedException;
+ private Object asyncResult;
+
private CountDownLatch asyncResultLatch;
@@ -105,29 +105,23 @@ public FlashMap getFlashMap() {
return RequestContextUtils.getOutputFlashMap(mockRequest);
}
- public void setAsyncResultLatch(CountDownLatch asyncResultLatch) {
- this.asyncResultLatch = asyncResultLatch;
+ public void setAsyncResult(Object asyncResult) {
+ this.asyncResult = asyncResult;
}
public Object getAsyncResult() {
HttpServletRequest request = this.mockRequest;
if (request.isAsyncStarted()) {
-
- long timeout = request.getAsyncContext().getTimeout();
- if (!awaitAsyncResult(timeout)) {
+ if (!awaitAsyncResult(request)) {
throw new IllegalStateException(
- "Gave up waiting on async result from [" + this.handler + "] to complete");
- }
-
- WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.mockRequest);
- if (asyncManager.hasConcurrentResult()) {
- return asyncManager.getConcurrentResult();
+ "Gave up waiting on async result from handler [" + this.handler + "] to complete");
}
}
- return null;
+ return this.asyncResult;
}
- private boolean awaitAsyncResult(long timeout) {
+ private boolean awaitAsyncResult(HttpServletRequest request) {
+ long timeout = request.getAsyncContext().getTimeout();
if (this.asyncResultLatch != null) {
try {
return this.asyncResultLatch.await(timeout, TimeUnit.MILLISECONDS);
@@ -139,4 +133,8 @@ private boolean awaitAsyncResult(long timeout) {
return true;
}
+ public void setAsyncResultLatch(CountDownLatch asyncResultLatch) {
+ this.asyncResultLatch = asyncResultLatch;
+ }
+
} | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.